Joe Joe -4 years ago 106
Linux Question

shell script behavior across different linux distros

I have a general question about shell scripts and process tables across 2 different operating systems.

On a SuSE Linux system, I run a script called joe.sh. It is a simple script that does the following




echo "Hello Joe "
read x





If I do a
ps -ef | grep [j]oe.sh -
it will find a result that will look something like this




joe 15532 24267 0 09:40 pts/2 00:00:00 /bin/sh ./joe.sh





That is assuming I launch another terminal and dont hit enter on the script.

However, If I do this same thing on an oracle linux system, I get no match UNTIL I add a shebang to the script

#!/bin/bash
echo "Hello Joe"
read x


Is there some default in the environment in SuSE that would get set? I'd like to replicate that behavior on the Oracle Linux system.

Answer Source

I think what you are looking for is : interpreter-script

Anyway, the script should always have a shebang line. (I second John)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download