[Home]ForLoop

Home | RecentChanges | Preferences

For Loops

For example:

  foreach x (1 2 3)
     echo $x
  end

More interesting:

  foreach x (a b c)
    echo cp $x blah/$x
  end

Still more interesting:

  foreach x (foo.txt bar.txt baz.txt)
    cp $x /home/yourname/tmp/$x
  end

You can also use "*":

  foreach x (*.txt)
    cp $x /home/yourname/tmp/$x
  end

-- LionKimbro


Home | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited November 8, 2003 21:44 (diff)
Search: