Often times you may come up with some really cool shell command to get the exact kind of data you looking for only to find out that when you parse it into a for loop, the command falls a part:
Case A – My Cool Command
# Get’s a print out of the disk information without the leading /dev/
df -h | grep ‘hd|sd’ | sed s/\/dev\///
*NB. To escape a character in sed, two backslashes are required.
Case B – Now My Cool Command in For Loop
for i in `df -h | grep ‘hd|sd’ | sed s/\/dev\///`; do echo $i; done
*NB. Requires Three backslashes are required