Bash

2013/04/23 Linux

License: (CC 3.0) BY-NC-SA

Tips

function argument

  • ”$@” can stop arguments split, but also stop shell expandation
  • array: a=(1 2 3); for i in ${a[@]}; do echo $i; done; echo ${#a[@]}; echo ${a[1]}
  • ${var#*str} substr after first str
  • ${var##*str} substr after last str
  • ${var%str*} substr before last str
  • ${var%%str*} substr before first str

Search

    Table of Contents