What does it mean to have a variable inside square brackets? Boolean?
For example:
[ $FILES ] || { print "File not found." }[ $VERIFY ] && { print "file verification fail" }
What does it mean to have a variable inside square brackets? Boolean?
For example:
[ $FILES ] || { print "File not found." }[ $VERIFY ] && { print "file verification fail" }[] invokes the test command which allows you to run conditional tests based on what arguments you supply inside them.
For the examples you have supplied:
$FILES is a single argument, so the test will return True if the argument is not null. Piped with || (Logical OR), whenever $FILES is 'null', test will return a non-zero exit status (1) thus printing "File not found."$VERIFY except being piped with && means that print "file verification" will execute as long as $VERIFY is not null (as test will return a status of 0 in this case).I will also add that there also exists [[]] which is the 'newer' test and is more commonly used
EDIT: I would also recommend enclosing variable names in double quotes ("") as they are technically arguments to a command.