[PD] bash gurus in the list?
Mathieu Bouchard
matju at artengine.ca
Thu Jun 3 21:33:46 CEST 2010
On Thu, 3 Jun 2010, enrike wrote:
> BLKID = `blkid | grep ${2}1 | awk '{ for(i=1;i<NF;i++) { if( $i ~ "UUID" ) {
> print $i } }
> if anyone could break it into chunks or pseudocode for me it would be really
> helpful...
it's missing a final ' for awk and a final ` for the value to assign to
BLKID.
it looks for the value of $2, followed by a "1" character, in the output
of BLKID, then it looks for a field that contains the letters UUID. The
field number ($i) is then assigned to the BLKID variable. Field numbers
start at 1. Delimiters are any sequence of spaces and tabs. If a delimiter
begins a line, the delimiter is ignored. NF is the number of fields and
thus the for-loop should say i<=NF because i<NF would skip the last field.
what do you need to know ?
_ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801
More information about the Pd-list
mailing list