Results 1 to 3 of 3
Thread: shell scripting
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Jun 2004
Is there any major diffrences between scripting in FreeBSD and Linux? Will one script written for bash in BSD work on my Fedora box?
If you are referring to the Bash shell, then it should work identically on both FreeBSD and Linux. The reason for this is because Bash is GNU, so it would be the same source code compiled on both systems. You may want to make sure that the first line in your source code is "#!/bin/bash" to make sure that it is run under the bash shell as opposed to whatever shell you execute it from.
Hope this helps...
- Join Date
- Nov 2004
Yes, if you're writing a bash script, use #!/bin/bash
If you're writing a sh script, use #!/bin/sh
It's very annoying when trying to use a bash script which incorrectly calls /bin/sh and doesn't work. But as long as you write it for the correct interpreter, bash, sh, tcsh, chsh, zsh, ksh, or whatever, it will work. This is assuming though that the specific interpreter is on the system, and the script uses commands, directorieds, files, and variables which will be on the system. But, chances are pretty good that it will work unless you use any very non standard stuff.