Bash - store results of a command into variable

15 Oct 2017

OUTPUT="$(ls -1)"
echo "${OUTPUT}"

or equivalent

OUTPUT=`ls -1`

Store into an array:

array=($(ls -d */))
[ bash  ]