Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Script 101 (for DUMMIES), How do I use  #!/bin/sh ...or  ## ...< Next Oldest | Next Newest >
JPsDad Offline





Group: Members
Posts: 8
Joined: April 2005
Posted: Jan. 11 2008,01:16 QUOTE

In looking for answers to various howto questions, I see answers that say: i wrote a script
#!/bin/sh
..... or

Code Sample or


compiled for DSL kernel 2.4.31 - DSL ver2.0 up
               INSTRUCTIONS
## Install the driver. In EmelFM select ipw2200-k2.4.31.dsl and press "MYDSL"
## or the manual way - open an xterminal
sudo /etc/init.d/mydsl-install/<mylocation>/ipw2200-k2.4.31.dsl
## first we need to become superuser
sudo su
## now we need to run "depmod"  which is no problem with a HD install
## but difficult with the liveCD (and frugal) because much of the filesystem is read-only.
## so for a liveCD we need to make certain files writeable
## by running /home/dsl/depmodscript.sh  which is provided in this package.
## So run this next command only for liveCD  not HDinstalls
/home/dsl/depmodscript.sh
## map our new driver modules
depmod
## Now load the driver
modprobe ipw2200
## if no error messages  this should create a network interface  eth0 (or eth1  etc)
## you can check this by running "ifconfig -a"
...
I don't have any confidence in my attempts to follow these helpful responses. Where do I find the DSL for DUMMIES Manual so that I can RTFM and know what it told me to do??
Back to top
Profile PM YIM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Jan. 11 2008,02:00 QUOTE

#!/bin/sh as a first line tells an executable script to use /bin/sh as the interpreter for that script. If the script is already being run by sh (such as using the command "sh scriptname" or sourcing the script from another sh script), that line is not needed. If the file is not set with executable permissions (example: 755), that line means nothing and must be run specifically with the sh command or by sourcing into another sh script.

The other hash marks (#) are simply comments. They designate lines that are ignored by the interpreter and used for the education of the user...often they help the user understand what the script is doing or to modify the script for unique conditions. In this case I would guess the double hash marks were used simply to create an obvious separation between the comments and the actual commands used.

Take a look at the documentation at tldp.org. There is one particular piece that is specifically for the bash newbie:
http://www.tldp.org/LDP/Bash-Beginners-Guide/html/index.html


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
^thehatsrule^ Offline





Group: Members
Posts: 3275
Joined: July 2006
Posted: Jan. 11 2008,07:30 QUOTE

If you really want to be specific, anything after #'s (on the same line) are designated as comments.
In essence, anything you enter in the command prompt can be saved into a script and executed as mikshaw described.

fyi, you can use the "[ code ]" (without spaces) tags in the forum.
Back to top
Profile PM 
WDef Offline





Group: Members
Posts: 798
Joined: Sep. 2005
Posted: Jan. 11 2008,08:40 QUOTE

Google will find many "introduction to bash scripting" type tutorials.  A search of this forum from the beginning will find a few good links.  That's how most of us started.  

A script is just a way of stringing together commands in a file.  Bash is the default scripting language on most linux systems.  Just a little knowledge of bash will greatly help your journey into linux.

Since dsl is a minimalist distro without as much in the way of soft landings as provided by the bigger distros, you will get the most out of it if you treat linux as a self-education exercise and make use of the wonderful resources provided by your forum search button and Google or your favorite search engine.
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Jan. 11 2008,15:34 QUOTE

A very useful thing someone pointed out to me a while ago, when using Google for linux-specific queries it is often best to go to google.com/linux rather than just google.com

--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
4 replies since Jan. 11 2008,01:16 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: Script 101 (for DUMMIES)

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code