- A script gets its arguments in
$1,$2and on, their number in$#, all of them separately in"$@". Without quotes an expanded value is split at spaces again. [ -f "$f" ],-d,-e,-r,-stest a path before you work with it, andif … then … else … fipicks what to do.- The exit status is the script's answer:
exit Nsets it, and a usage line for a wrong call goes to the error stream through>&2. - At the start of the lesson the quotes in the call delivered
my file.txtto report.sh whole, and the unquoted$@and$finside the script cut the name apart again.
Step 7 of 7 · summary · 2 min
Summary
Found an inaccuracy? Report an error in the lesson