Hi! I just recently started messing around with Unix, but I've come upon one problem multiple times. Whenever I try to run a shell script, for example;
The file is in the correct directory, I've verified that with ls -l, I've also used chmod 700 example1, to give myself permissions to execute the shell, but I just keep getting the same problem. Thanks for any help!
1) chmod 755 /full/path/to/filename.ext<CR>
2) use one of two methods to run it:-
A) /full/path/to/filename.ext<CR>
B) ./filename.ext<CR>
From the current directory/drawer/folder.
<CR> is the carriage return or enter key...
EDIT:
Note in your script the first line should read:-
But perhaps this: (Different OS/shell would produce different error. This is from Linux & Bash)
$ echo $'#! /bin/bash\r\necho hello world\n' > file; chmod a+x file; ./file
-bash: ./file: /bin/bash^M: bad interpreter: No such file or directory
$ sh
$ ./file
sh: 4: ./file: not found
Did you create the file in Windows? You need to remove the Windows line endings. This is just one of many ways:
Hi neutronscott et al...
Just for information purposes...
OSX 10.7.5 default bash terminal...
Last login: Sat Jan 25 09:46:55 on ttys000
AMIGA:barrywalker~> echo "text" > testtxt
AMIGA:barrywalker~> cd ..
AMIGA:barrywalker/Users> ./testtxt
-bash: ./testtxt: No such file or directory
AMIGA:barrywalker/Users> _