|
Programming C, bash, Python, Perl, PHP, Java, you name it. |
|
Thread Tools | Display Modes |
|
|
|||
Bash script cannot execute - Is a directory
Whenever I execute a bash script, I get this error:
Code:
$ ./script.sh hello world ./script.sh[3]: /home/guitarscn: cannot execute - Is a directory Code:
#!/bin/ksh echo "hello world" |
|
|||
It is not a bash script, it is a ksh script. Do you have a 'ksh' in /bin?
Code:
$ ls -l /bin/ksh -r-xr-xr-x 3 root bin 410744 Apr 4 2010 /bin/ksh
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
Whoops, I meant it was a ksh script, sorry, a bit used to bash scripting
Code:
$ ls -l /bin/ksh -r-xr-xr-x 3 root bin 384084 Aug 16 10:48 /bin/ksh |
|
|||
Yea, I don't have a newline there either...this is what I don't understand
If you're on OpenBSD (4.8-Release for me) could you try making the same script and see if it reproduces the same error? |
|
|||
Assuming the execute has been set, you could check whether you not accidently entered some control characters
Code:
$ hexdump -C script.sh 00000000 23 21 2f 62 69 6e 2f 6b 73 68 0a 65 63 68 6f 20 |#!/bin/ksh.echo | 00000010 22 68 65 6c 6c 6f 20 77 6f 72 6c 64 22 0a 0a |"hello world"..| 0000001f
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
Okay, I just deleted the file and made a new file, and now suddenly it works...must've been something invisible. I'm kind of curious as to what it was but it seems to be fine now.
|
|
||||
If you had done a hexdump as j65nko suggested we might have known
Maybe there is still a backup file in /tmp?
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things. |
|
|||
Mmm...nothing there except a couple X-related files and an xmms dump
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Solved] How to make 2 separate arguments in 1 bash script? | guitarscn | Programming | 1 | 31st August 2010 09:12 PM |
Writing a simple script to edit text files and execute commands | guitarscn | Programming | 11 | 24th August 2010 09:21 PM |
strange "~" directory in home directory | gosha | OpenBSD General | 5 | 23rd February 2009 06:12 PM |
execute commands from xinitrc | rex | FreeBSD General | 3 | 22nd October 2008 10:24 PM |
Cron won't execute a perl script | ivanatora | FreeBSD General | 4 | 17th August 2008 07:53 AM |