I wrote a shell script to just check whether file exists or not. Below is the snapshot:
#!/bin/sh
#version/300
file="test.txt"
function file_status_check {
if [ ! -f "$1" ]
then
echo "file is already present"
fi
echo "file is not present. Please create the file"
}
file_status_check $file
It is saying syntax error:
testscript.sh: 7: testscript.sh: function: not found
file is already present
file is not present. Please create the file
testscript.sh: 13: testscript.sh: Syntax error: "}" unexpected
what am I doing wrong? Please suggest.