This is an old revision of the document!
index() #@ Print the position of $2 in $1 { #@ USAGE: index STRING SUBSTRING local idx case $1 in *$2*) idx=${1%%$2*} echo $(( ${#idx} + 1 )) ;; *) echo 0 ;; esac }
die() #@ Exit with error code and optional message { #@ USAGE: die RETURN_CODE [MESSAGE] result=$1 shift [ -n "$*" ] && printf "%s\n" "$*" >&2 exit "$result" }