Find the answer to your Linux question:
Results 1 to 3 of 3

Thread: shell scripting

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Jun 2004

    shell scripting

    Hello all!

    Is there any major diffrences between scripting in FreeBSD and Linux? Will one script written for bash in BSD work on my Fedora box?


  2. #2
    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...

  3. #3
    Linux Engineer
    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts