Loop through Array in Bash


/ Published in: Bash
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.