skipping a variable using while read in bash

Posted by Aleksandar Ivanisevic on Server Fault See other posts from Server Fault or by Aleksandar Ivanisevic
Published on 2010-03-25T21:16:12Z Indexed on 2010/03/25 21:23 UTC
Read the original article Hit count: 940

Filed under:
|
|
|

i'm reading a few variables from a file using

while read a b c; do
  (something)
done < filename

is there an elegant way to skip a variable (read in an empty value), i.e. if I want a=1 b= c=3, what should I write in the file?

Right now i'm putting

1 "" 3

and then use

b=$(echo $b | tr -d \" )

but this is pretty cumbersome, IMHO

any ideas?

© Server Fault or respective owner

Related posts about bash

Related posts about bash-scripting