Typo in sample script from book?

Hello, I'm new to this forum, and I apologize in advance if I did something wrong here.

I am pretty stumped here as I am still getting the error message, "./comc1.sh: test: argument expected." after executing the script itself.

Here's the script file I modified:

I tried executing line 4 without the backquote in the shell. I tested it when there is no .c file in the current directory. I also created a fake .c file, and got the expected result too.

I also tried executing line 5 by itself after creating the child bash shell process, so I don't get myself kicked out of the term. Got both conditions to execute without a problem when lastfile was null and non-null.

Am I missing something here? I'm no script expert yet, but if I am suppose to enclose something else to make this script run, then can someone please points that out? Thanks.

[ -z "$lastfile" ] && { echo "No C program found" ; exit 1 ; }
1 Like