[plug] Need to learn basic scripting

Senectus . senectus at gmail.com
Fri Jan 7 10:39:07 WST 2005


On Thu, 6 Jan 2005 21:46:26 -0500, bwarff <bwarff at obsidian.com.au> wrote:
> with simple scripting like that, all you need to do is put those lines into a file,
> and make the file executable.
> 
> it also helps to tell the shell which interpreter to use (in this case itself),
> you do this via a hash-bang trick on the first line of a file.
> 
> eg:
> 
> -----------------snip--------------------------
> #!/bin/bash
> ifconfig eth1 down
> ifconfig eth1 up
> ip route add default via 172.24.192.5 metric 0
> smbmount //ptcpms01/data /home/user/Kdrive/ -o
> username=XXXXXX%XXXXXXX,fmask=644,dmask=755,uid=1000,gid=100,debug=0,workgroup=XXXXXXXX
> smbmount //wafile02/data /home/user/Idrive/ -o
> username=XXXXX%XXXXXXX,fmask=644,dmask=755,uid=1000,gid=100,debug=0,workgroup=XXXXXXXXX
> ----------------end snip------------------------
> 
> if this file was called work-net.sh, then you would make it executable with
> "chmod 700 work-net.sh"
> 
> then ./work-net.sh would run it...
> 

Damn.. that WAS easy :-)
Thanks for that.. works perfectly even better that I can slap sudo at
the beginning of each line and now I don't need to su into root
anymore :-)


-- 
Ubuntu Warty 4.10



More information about the plug mailing list