#!/bin/sh
#echo "Please type oracle-lower case please:"
#read X
#if [[ "${X}" != "oracle" ]]
#then
# echo "Sorry that is not oracle, try again"
# exit 1
#else
# echo Thank you
#fi
find / -name oracle 2>/dev/null |
while read line
do
bdf 2>/dev/null | grep "$X" | awk 'BEGIN {total=used=free=0}
{total +=$2
used +=$3
free +=$4}
END {print "total space for oracle: "total;
print "free space available for oracle: "free;
If I run the entire script, the result is 0's. If I run it from the find down I get numbers? Why cant I run the whole script and come up with numbers?
Part of the script is missing? There is no ending } and quote for the awk statement and the done statement of the while loop isn't there either.
It seems to me this script will find any path on the system that contains oracle. So if you have /oracle on your system it will list all subdirectories and files. Suppose that gives you 100 lines. The script will then enter the loop and since X is empty bdf will not get filtered. So what you end up with is 100 * a result of the total of all filesystems that are mounted on your host. It seems to me you do not need the while do loop and I am not sure why you need the find statement.