Linux Shell Scripting Cookbook 2nd Notes

  1. get the length of a variable:
1
length=${#var}
  1. arguments:
1
2
3
4
5
6
$1 is the first argument
‰‰$2 is the second argument
‰‰$n is the nth argument
‰‰"$@"expands as "$1" "$2" "$3" and so on
‰‰"$*" expands as "$1c$2c$3", where c is the first character of IFS
‰‰"$@" is used more often than "$*"since the former provides all arguments as a single string