Command not found
Jonathan Hudson
jh+ubuntu at daria.co.uk
Sat Mar 3 22:03:32 UTC 2012
On Sat, 03 Mar 2012 21:34:54 +0000, John Sampson wrote:
>Hello -
>
>I am new to Ubuntu, being a Windows user. I am accustomed to
>running batch files by typing their names in a shell. When I try
>this in Ubuntu 11.10 there is a 'command not found' error.
>I found that the file has to be in a folder in the path for it to be
>runnable from a shell. I attended to this by copying the file to
>'/usr/bin' and also navigated to '/usr/bin' before tryng to run it.
>I typed 'ls <filename>' to ensure that the file was present.
>I tried prefixing with 'sudo' and checked the spelling of the file
>name. Does it have to have a special suffix or anything? I cannot
>think of any other solution to this. Any advice will be welcome.
>
>Also is there a brief basic account of the differences between
>Ubuntu and Windows for reluctant users like myself who only
>use Ubuntu because the program they want to use won't run
>in Windows?
>
>Regards
>
>_John Sampson_
>
Scripts need to (a) be executable unless you provide the name of the
interpreter, (b) either on the PATH or have an absolute or relative
path provided and (c) unless you provide the name of the interpreter,
have a #! line at the start.
e.g.
$ ./myscript
$ ./myscript.sh
$ sh myscript
where myscript is executable (chmod +x myscript) and contains a #!
#!/bin/bash
echo "My script
In general, you should not place non-system scripts in a system
directory (/usr/bin) or do "user" stuff as root.
More information about the ubuntu-users
mailing list