I am trying to put the contents of a simple command into a bash array, but I have a few problems.
df -h | awk '{ print $5" "$6 }'
gives the percentage used on file systems on my system the output is as follows:
1% /dev 1% /dev/shm 1% /var/run 0% /var/lock 22% /boot 22% /home 22% /home/steve
Then I would like to put each of these lines into the array bash array = $ (df -h | awk '{print $ 5 $ 6}')
However, when I print the array, I get the following:
5% / 1% /dev 1% /dev/shm 1% /var/run 0% /var/lock 22% /boot 22% /home 22% /home/steve
Bash forms an array based on spaces, not line breaks, how can I fix this?
arrays bash awk
user428300
source share