CIFS file system check.

I have written a script to take backup of linux data on window's shared folder.
I have used following method in my script.

 mount -t cifs <windowshare> -o username=username,password=myPassword <mountlocation>

However most of linux system doesnt support CIFS filesystem.
How would i check if CIFS filesystem or service is present or not before executing the script?

You may want to check the results of a faked mount, e.g.:

[root@leonov] mount -f -a; RV=$?; echo "Return Value: $RV"
Return Value: 0
[root@leonov] mount -f crap; RV=$?; echo "Return Value: $RV"
mount: can't find crap in /etc/fstab or /etc/mtab
Return Value: 1
[root@leonov] mount -f crap 2>/dev/null; RV=$?; echo "Return Value: $RV"
Return Value: 1

I have tried as u suggested but not getting what was desired.
for example

# mount -f cifs
mount: can't find cifs in /etc/fstab or /etc/mtab
[root@TomcatServer ntserver]# echo $?
1

However i can sucessfully mount the share using cifs on same machine.

mount -t cifs //10.180.8.23/downloads -o username=username,password=password /mnt/ntserver
mount -f -t cifs //10.180.8.23/downloads -o username=username,password=password; echo "$?"

I will prefer to use following code.

HAVE_CIFS=no
grep -q cifs /proc/filesystems && HAVE_CIFS=yes
/sbin/modinfo cifs &>/dev/null && HAVE_CIFS=yes

if [ "x$HAVE_CIFS" = "xyes" ]; then
  ...
fi

Why bother with a fake mount? Just go ahead and try to mount it for real. Before continuing with the script, check the exit status of the mount. If it succeeded, continue. If not, abort. You should be doing this anyway, as the mount could possibly fail for a different reason other than lack of cifs support.

That should be a different reason.

Because if i go as per your suggestion the problem is i may not be able to recognize if cifs file system is supported or not.

According to me first file system check followed by status check for actual statement should be done.

If your kernel makes its configuration available via the /proc filesystem, you can use something like

zcat /proc/config.gz | grep -qE 'CONFIG_CIFS=[ym]'

to check for CIFS support.