SkÃ¥ne Sjælland Linux User Group - http://www.sslug.dk Forside   Tilmelding   Postarkiv   Forum   Kalender   Søg
MhonArc Dato: [Date Prev] [Kronologisk oversigt] [Date Next]   TrÃ¥d: [Date Prev] [Oversigt trÃ¥de] [Date Next]   MhonArc
 

Shell programmerings artikel



Hejsa alle.

På 
http://linux.com/development/newsitem.phtml?sid=64&aid=10910

er der en ret uinteressant artikel om shell scripts/programmering. 

Til gengæld er der nogen _fede_ links i bunden, til folk der _virkeligt_
ved hvad de snakker om. F.eks. fra den om csh considered harmfull:

Et lille highlight
-----------------------------------
Consider the pipeline:

    A | B | C

You want to know the status of C, well, that's easy: it's in $?, or
$status in csh.  But if you want it from A, you're out of luck -- if
you're in the csh, that is.  In the Bourne shell, you can get it, although
doing so is a bit tricky.  Here's something I had to do where I ran dd's
stderr into a grep -v pipe to get rid of the records in/out noise, but had
to return the dd's exit status, not the grep's:

    device=/dev/rmt8
    dd_noise='^[0-9]+\+[0-9]+ records (in|out)$'
    exec 3>&1
    status=`((dd if=$device ibs=64k 2>&1 1>&3 3>&- 4>&-; echo $? >&4) |
                egrep -v "$dd_noise" 1>&2 3>&- 4>&-) 4>&1`
    exit $status;
------------------------

_DET_ er smukt. Kan næsten få en voksen mand til at tude... :-)

Check de links ud. Fede for shell'en.

Mads

-- 
Mads Bondo Dydensborg.                               sslug@sslug
During the ILOVEYOU Outlook Email Virus outbreak, some organisations disabled
the mail system and issued warnings over the intercom. The Joys of Windows...



 
Forside   Tilmelding   Postarkiv   Oversigt   Kalender   Søg

 
 
Henvendelse vedrørende websiderne til <www_admin>. Senest ændret 2005-08-10, klokken 21:42
Denne side vedligeholdes af MHonArc .