This content has been marked as final. Show 2 replies
"If unmatched" indicates a problem with your if-then construct. Did your create the script under Linux or did you copy it from a MS Windows system? In the later case your script may not have proper line endings.1 person found this helpful
What happens after you process your script with the "dos2unix" command (yum install dos2unix) or for use perl, for intance
perl -pi -e 's/\r\n/\n/g' script.sh
1 person found this helpful
user6149203 wrote:Behaviour may differ between shells - but for bash, this operator expects numeric input. So if +$tmp+ is null/nothing, the condition will fail. E.g.
if [ "$tmp" -eq "0" ]
/home/billy> LINES="" // -eq operator results in a numeric evaluation that fails /home/billy> if [ "$LINES" -eq "0" ]; then echo "Lines is zero"; fi; bash: [: : integer expression expected // the = operator supports string checking and works /home/billy> if [ "$LINES" = "0" ]; then echo "Lines is zero"; fi;