shell script question with cat

tony4704

Senior member
Jul 29, 2003
336
0
0
Hey all I created a simple shell script, im a noob to shell scripting, but I am trying to figure out what im doing wrong.

here is the script:

#!/bin/sh
if [ 'cat file' -eq "" ]
then
echo "installation not found"
else
cat file
fi


What im trying to accomplish is if cat can open the file then show the contents of it, if it cant then display a message. What am I doing wrong here? Thanks.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
As a side note, make sure the quotes around 'cat file' are backticks (i.e. `:the character under ~) instead of single quotes which you've posted above.