[root@test ~]# cat get_fs_from_path.sh
#!/bin/bash
F_PATH=$1
FS_RESULT="/"
FS_LENGTH=0
for fs in `df |grep "/"|awk '{print $6}'`
do
if [[ $F_PATH =~ $fs ]]
then
CURRENT_FS_LENGTH=${#fs}
if [ $CURRENT_FS_LENGTH -gt $FS_LENGTH ]; then
FS_LENGTH=${#fs}
FS_RESULT=$fs
fi
fi
done
echo "$FS_RESULT"