#!/bin/bash
fuser /mount/foo
echo $?
if [ $? = 0 ]; then
    echo "There are no processes accessing foo."
else
    echo "foo is in use."
Echo$? is returning '1' because the fuser process is accessing the mount - rather than echoing "The mount is in use," it echoes "There are no processes accessing the mount." I'm not sure what could be causing this contrary behavior aside from syntax but maybe I'm building it completely incorrectly.
                        
Your second
$?evaluates the result ofecho, that is supposed to be 0. Removeechoor use a variable instead: