-   Linux - Newbie (
-   -   What does this script command mean? (

ubume2 05-23-2008 02:48 PM

What does this script command mean?
I am a noob. Have been trying to get an automatic wireless connection on Ubuntu 8.04. Have tried the HowTo's on the ubuntu forum. I have been able to manually connect to the internet. But couldn t get an automatic connection on boot.

Following instructions on the manual connection howto, I edited the /etc/rc.local and added the commands I used to get a manual connection. I rebooted, but no connection.

I noticed that the first line of /etc/rc.local is :
#!/bin/sh -e . I don't know what that is, but it didn't work for me. I did use chmod to give permissions

I was familiar with #!/bin/bash, so I commented out the other, and used what I was familiar with. And it worked.

So what is #!/bin/sh -e and why didn't it work for me?

jonlake 05-23-2008 03:12 PM

From the man page:

-e Exit immediately if a command exits with a
non-zero exit status.

SlowCoder 05-23-2008 03:35 PM

The line "#!/bin/sh" tells Linux what shell to use for execution of the script. In this instance, you're using the sh shell, which is actually an older variant of bash. Bash is compatible with sh, and is more extensible.

In many current distributions /bin/sh is actually a link to /bin/bash. Hence, when sh is called, bash is actually what you are running.

asymptote 05-23-2008 03:38 PM

Also if you try entering this into a text editor like gedit and then save the file, you'll notice it change colours which indicates that it is being recognized as the start of a shell script. You'd think the # would mean comment and disregard what follows but the ! negates that.

All times are GMT -5. The time now is 10:09 AM.