I was wondering, is it possible to get make a batch file for bash?
Thanks in advance,
Jules
'batch' file for bash
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
..or the more "vendor-neutral" term, a Shell Script.
http://en.wikipedia.org/wiki/Unix_shell
http://en.wikipedia.org/wiki/Shell_script
http://en.wikipedia.org/wiki/Unix_shell
http://en.wikipedia.org/wiki/Shell_script
Have you tried?
just doing
inside a file then
Will do the same as a batch file.
If you want to be better, add this at the top of your file:
then,
Then you can just run it:
just doing
Code: Select all
my command1
my command2
Code: Select all
sh myfile
If you want to be better, add this at the top of your file:
Code: Select all
#!/bin/sh
Code: Select all
chmod u+x myfile
Code: Select all
./myfile
If you're not doing anything terribly complex, you won't need a different script for sh than bash. On a lot of Linux distributions, /bin/sh is linked to bash, anyway.suthers wrote:I tried using sh to execute a script but it always says command not found
There's two possibilities for why you get a command not found on sh:
1) You're using MSYS or Cygwin and there is no special treatment of the scripting shell, so no sh link.
2) You're using an odd distribution that stuffed sh in /sbin and didn't include /sbin in your path.
In either case, just use bash instead of sh in the invocation.