The script works as follows:
First it we declare the Variable FILE to equal what ever you specify on the command line when you execute the script.
Next step is the test function, we say if (-f) the $FILE (you entered) exists then,
print on the screen file exists else print it does not.
#!/bin/bash
FILE=$1
if [ -f $FILE ]; then
echo \"File $FILE exists\"
else
echo \"File $FILE does not exists\"
fi
I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept. Thank you for the post.
ReplyDeleteBry
www.gofastek.com