sslug-teknik team mailing list archive
-
sslug-teknik team
-
Mailing list archive
-
Message #28131
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. madsdyd@xxxxxxxxxxxx
During the ILOVEYOU Outlook Email Virus outbreak, some organisations disabled
the mail system and issued warnings over the intercom. The Joys of Windows...
Follow ups