Skip to content

Instantly share code, notes, and snippets.

@SeanPlusPlus
Created April 18, 2011 18:05
Show Gist options
  • Save SeanPlusPlus/925822 to your computer and use it in GitHub Desktop.
Save SeanPlusPlus/925822 to your computer and use it in GitHub Desktop.
reads lines from a file and echos those lines to your terminal
#!/bin/bash
#
# ReadFromFileWriteToArray.sh
#
# pass a file as a param to this command
declare -a listOfThings
i=0
while read line ; do
listOfThings[$i]=${line}
echo ${listOfThings[$i]}
i=$i+1
done < $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment