bash - How ${@: -1} expand to last argument -
i knows ${para:[start]:[length]}
, $@
notation i'm unable find out how ${var: -1}
evaluates last argument.
consider length - 1
resolve in last character in $var
. same goes ${var:(-2)}
, ...:
var='hello' printf "%s\n" "${var:(-1)}" # o printf "%s\n" "${var:(-2)}" # lo printf "%s\n" "${var:(-3)}" # llo
Comments
Post a Comment