I get an error message. /test.sh: line 13: [: missing `] in the test.sh file I tried using brackets and other parameters, such as -a or by checking the size of the p1 file, but the error always exists, and the else statement always runs regardless entered input. I even tried to remove; on line 13, but that didn't help.
test.sh
#!/bin/bash echo "Enter app name" read y $y & top -b -n 1 > topLog.log #-w checks for the whole word not and sub string from that word grep -w "$y" topLog.log > p1 #-s option checks if the file p1 is present or not if [ -s "p1"]; #line 13 then echo "Successful " else echo "Unsuccessful" fi rm p1
I am new to bash scripting. So if there is a stupid mistake, please excuse me.
scripting bash
quick- Apr 13 '13 at 21:18 2013-04-13 21:18
source share