I am making a small program in shell script but the problem is that I cannot print 2 variables in a single line with a good format.
Example:
#!/bin/bash
top=70
espacio_fs=`df -h | tr -s " " "," | cut -d"," -f6 | sed '1d'`
espacio=`df -h | tr -s " " "," | cut -d"," -f5 | tr -s "%" " " | tail -n +2`
for i in $espacio
do
if [ "$i" -le "$top" ] ; then
echo "$espacio_fs" "$espacio" > fss.txt
else
echo "No existen filesystems mayores al 70%"
The result that it throws me in the fss.txt output is:
Filesystem mayores a 70% son:
/
/dump
/tmp
/backup
/oracle
/grid
/boot
/dev/shm
4
8
3
22
85
57
6
31
I need to print that output with the following format
Filesystem mayores a 70% son:
Filesytem Uso(%)
/ 4
/dump 8
/tmp 3
/backup 22
/oracle 85
/grid 57
/boot 6
/dev/shm 31
How can you achieve this connection?
Thank you