sybase and shell

I am writing a shell script that verifies if a device is created on wrong mounts

1> sp_helpdevice
2> go | awk '{print $2}' | grep database | grep -v `df -k | grep /dev/dsk | awk '{print $6}'`

So if things are ok, the output should return nothing
If the result gives 1 or more entry, then at least 1 device is created on the wrong mount

My question: how to do this check?

thanks

I don't know about your grep and awk stuff but you can do something like this.

echo "sp_helpdevice /ngo" > $infile
echo ${PASSWORD} | isql -Usa -i${infile} |awk '{print $2}' | grep database | grep -v `df -k | grep /dev/dsk | awk '{print $6}'`