Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Opening a file for READing within script? (Last question today ;) )
- X-seq: zsh-users 13578
- From: "Webb Sprague" <webb.sprague@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Opening a file for READing within script? (Last question today ;) )
- Date: Wed, 10 Dec 2008 09:34:42 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=7iBzLZBFImRErcSFrd9T/6LRNUxNpvKnlbacjzA6wp4=; b=AtvM5N0U50Twps62ROzmcdTZ/wrXL+myNQmtfWA9VGxgku+0ENCaTiise5xIfEyPWU wTzwX/C0MwAb6Q3p50ApBenyhKDHbKtZMnP3es7bxhi3U+4xegUyTD/nGV8iYCeEuQtY TVLxcMtV1ag3AiTX5EvXcz2y2HSKxr6WsU9R8=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=beSzt58rCSlsxzSjonykvEIJRKNYOs/Fl/+95jOWR/ZD2t/ZVD1LDzSsWqEyjNzD7m iEDplLVDgUCMBpnsr7q6oEsWr3bZNOPdGp/fd2zc2iRH3iek4yWx4974l6UjkOlM+z// a13kgrn+wEFfdQEEI5Jtu61Jd++VoVtQHoiEk=
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
I want to open a file given at the command line for reading by
associating it with a file descriptor number and then running
read -u 4 HEADERLINE
echo "Special header line behavior $HEADERLINE"
while read -u 4 DATALINE ; do
echo $DATALINE
sleep 1
done
I am doing this because I need to process the header differently than
the data, and I want the user to give the file name on the command
line rather than cat it into a pipeline.
Thanks!
(Oh -- my final FINAL sneaky question -- is there a way to
automagically associate the OPTS with an associative array? like
optfill f:b OPTASSOC
modifying OPTASSOC to be {f->filename; b->EMPTY}, given command -b -f
filename; it would throw an error for required or non-standard opts
too, but not sure about good syntax ? If there isn't, I will write
one, but not today ....
)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author