Hi guys,
Newbe in scripting /bin/ksh I'm needing some help.
Working on : SunOS I386 Solaris5.10
Here is the idea:
I would like to create a function that will show only a part of the command df -h with sed.
The aim is to see only the disk name and the pourcentage of it. (eg"c0t0d0s0 / 70%")
In my full script I had the command and it's working well.
echo "toto" `df -h /|grep %| sed -e 's/[0-9].[0-9]G//g' -e 's/[0-9].[0-9]M//g' -e 's/[0-9]G//g' -e 's/[0-9]M//g' -e 's#/dev/dsk/#/#g'` "\n" >> $LOG &&
I would like to create a function that will take those command.
But I should have some mistakes
in because i cannot make it work. Does someone have an idea? thank
Here is my script
#!/bin/ksh
#
DATE=`date '+%y%m%d%H%M'`
LOG=/var/log/autosed$DATE.log
export LOG
DEBUG=echo
#function that permit to sow a part of the df -h command.
call_sed()
{
sedcmd=`grep % | sed -e 's/[0-9].[0-9]G//g' -e 's/[0-9].[0-9]M//g' -e 's/[0-9]G//g' -e 's/[0-9]M//g' -e 's#/dev/dsk/#/#g'` >> $LOG
df -h $1 | $sedcmd
}
call_sed "/"