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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -