Thanks dude thats worked like a charm.
Seems i was almost there but didn't use the correct { }
Could you explain the difference between { } and ( ) in the command grouping? Also i notied the ; at the end before } is vitally important otherwise the next command doesn't work.
e.g
Code:
This works and exits if cant null but echos got to here if can.
> ${OUTFILE} || { print "ERROR: cannot null output file. Exiting\n" >&2; exit 2; }
> ${TMPFILE} || { print "ERROR: cannot null tmp file. Exiting\n" >&2; exit 2; }
echo "got to here"
This doesnt work and never gets to echo even if null is successful
> ${OUTFILE} || { print "ERROR: cannot null output file. Exiting\n" >&2; exit 2 }
> ${TMPFILE} || { print "ERROR: cannot null tmp file. Exiting\n" >&2; exit 2 }
echo "got to here"