Hi all, Im trying to put the contents of a simple command in to a bash array however im having a bit of trouble.
df -h | awk '{ print $5" "$6 }'
gives percentage used in the file systems on my system output looks like this:
1% /dev
1% /dev/shm
1% /var/run
0% /var/lock
22% /boot
22% /home
22% /home/steve
I would then like to put each of these lines into a bash array array=$(df -h| awk '{ print $5 $6 }')
However when I print out 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 is forming the array based on white spaces and not line breaks how can i fix this?