###BEGIN#
#!/bin/bash
### Daily Volume Growth
#### Will execute once when file not exist and add first entry in the file
if [ ! -f volgrow ]; then
echo "Volume Name Total Size 'date +%F'" >> volgrow
echo "'ssh 192.168.1.2 df -h Volume1 |head -2 | tail -1 | awk '{
print $1,$2 }''" >> volgrow
echo "'ssh 192.168.1.2 df -h Volume2 |head -2 | tail -1 | awk '{
print $1,$2 }''" >> volgrow
echo "'ssh 192.168.1.2 df -h Volume3 |head -2 | tail -1 | awk '{
print $1,$2 }''" >> volgrow
fi
#### get all data in different variables
line1 = echo "'date +%F'"
line2 = "'ssh 192.168.1.2 df -h Volume1 |head -2 | tail -1 | awk '{ print $1,$2 }'' "
line3 = "'ssh 192.168.1.2 df -h Volume2 |head -2 | tail -1 | awk '{ print $1,$2 }'' "
line4 = "'ssh 192.168.1.2 df -h Volume3 |head -2 | tail -1 | awk '{ print $1,$2 }'' "
########### append variable value in line 1, 2, 3, 4
sed -i -e "1s%$%\t$line1%" volgrow
sed -i -e "2s%$%$line2%" volgrow
sed -i -e "3s%$%$line3%" volgrow
sed -i -e "4s%$%$line4%" volgrow
###END#