sourabhjha
Programmer
Hi,
Need some help reg shell script. I have a shell script which gets the filesystem space usage percentage and displays it. Here is the piece of script which does that.
filesystem=${arr[$i]}
spaceusage=`df -k|grep $filesystem|awk ' { print $5 } '`
echo ${arr[$i]}"="$spaceusage
don't bother about the array. "arr[$i]" basically is the filesystem name which is passed as a parameter. So if i pass the parameter to the program like "$myscipt.sh /test/file" the output will be "/test/file=30%"
Now what i want here is to remove that "%" in the output which is displayed. So the output should look like "/test/file=30".
Can someone tell please me the appropriate substring commands which i can use for the same.
Thanks in advance,
-Sourabh
Need some help reg shell script. I have a shell script which gets the filesystem space usage percentage and displays it. Here is the piece of script which does that.
filesystem=${arr[$i]}
spaceusage=`df -k|grep $filesystem|awk ' { print $5 } '`
echo ${arr[$i]}"="$spaceusage
don't bother about the array. "arr[$i]" basically is the filesystem name which is passed as a parameter. So if i pass the parameter to the program like "$myscipt.sh /test/file" the output will be "/test/file=30%"
Now what i want here is to remove that "%" in the output which is displayed. So the output should look like "/test/file=30".
Can someone tell please me the appropriate substring commands which i can use for the same.
Thanks in advance,
-Sourabh