[plug] Need to learn basic scripting

Timothy White weirdo at tigris.org
Fri Jan 7 14:19:19 WST 2005


Senectus . wrote:

>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 :-)
>
>

Or sudo ./work-net.sh

--
Tim White - Use the Fox, Luke!
PGP/GPG id: 602E944D, Pub Key Serv: subkeys.pgp.net
Fingerprint: 04C2 9682 B7B2 3006 009D  A9F3 067E EDCD 602E 944D
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!
--

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
URL: <http://lists.plug.org.au/pipermail/plug/attachments/20050107/60a83370/attachment.pgp>


More information about the plug mailing list