Posted By

webonomic on 12/03/09


Tagged

array loop


Versions (?)

Loop through Array in Bash


 / Published in: Bash
 

This creates an array of various linux shell names, loops through the array and ouputs a file called shell_locations.txt showing where the shells are located on the linux system.

  1. list=( sh csh bash zsh ksh tcsh )
  2. for i in ${list[@]};
  3. do
  4. whereis $i >> shell_locations.txt;
  5. done;

Report this snippet  

You need to login to post a comment.