Welcome to the Linux Foundation Forum!

issues with script for diskspace and mail monitor

Hi there guys / Girls,

I really seem to only ever post issues on here... :(

anyways, I hope someone can assist,

I found a script to do a Diskspace monitor and notification using shell scripting.

but when I try run it I keep getting a error, First off Im utilizing Red-Hat 5.3 and I am using the script using the root account.

# Shell script to monitor or watch the disk space
# It will send an email to $ADMIN, if the (free avilable) percentage
# of space is >= 80%
# set admin email so that you can get email
ADMIN="[email protected]"
# set alert level 80% is default
#echo $output
if [ $usep -ge $ALERT ]; then
echo "System Running low on Disk space \"$partition ($usep%)\" on $(hostname) as on $(date)" |

the Error I get is

bash: ./DiskSpace_Alert.sh: /bin/sh^M: bad interpreter: No such file or directory

but when looking the /bin/sh does exist


  • hey,

    i guess the issue is not with existence of /bin/sh file but with character '^M' that is present in the script. If you see the error it says something like " /bin/sh^M " so let me guess did u copy the script from windows file to unix box?
    if so then before executing type teh below command-

    #dos2unix <script_name>



Upcoming Training