• Data and Technology

    Posted on July 23rd, 2007

    Written by cliff

    Tags

    , , , , , ,

    Bash For loop Example

    I’m always forgetting the syntax to make “for” loops in Bash. I guess it serves me right for using foreach most of my UNIX life instead. Anyhow, I know I will have to come back here to find it, so I thought I would write put up this quick example with the hope that it [...]

  • Data and Technology

    Posted on January 17th, 2006

    Written by cliff

    Tags

    , , , , ,

    Foreach Example in tcsh

    I always forget the foreach syntax. Here is a quick example that reads all the contents of a directory into an array, prints out the name of each file, runs a simple grep on it, and ends.
    foreach i ( ` /bin/ls * ` )
    foreach? echo $i
    foreach?/bin/grep your_grep_string $i
    foreach? end