Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save flores/956124 to your computer and use it in GitHub Desktop.
Save flores/956124 to your computer and use it in GitHub Desktop.
assigning variable names to a space delimited, new-line separated file with sh's "while"
$ while read firstcolumn secondcolumn thirdcolumn; do
> echo -e "First column is $firstcolumn
> Third is $thirdcolumn \n"
> done << EOF
> i like cats
> and pie too
> baby baby yeah
> EOF
First column is i
Third is cats
First column is and
Third is too
First column is baby
Third is yeah
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment