redirect

  1. kenJackson

    A new twist on while-loops

    If you've ever tried to use a while-loop like this, you've experienced some frustration. #!/bin/sh RESULT= cat db | while read index color; do test "$index" = 2 && RESULT="$color" done echo "Index 2 is \"$RESULT\"" Where I'm using this file named db: 1 red 2 green 3 blue When you run...
Top