Tutorial by Examples

For example, consider the following that sets the contents of $@ to the contents of a given variable: a=(1 2 3) eval set -- "${a[@]}" This code is often accompanied by getopt or getopts to set $@ to the output of the aforementioned option parsers, however, you can also use it to creat...
While eval may not be needed for a pop like function, it is however required whenever you use getopt: Consider the following function that accepts -h as an option: f() { local __me__="${FUNCNAME[0]}" local argv="$(getopt -o 'h' -n $__me__ -- "$@")" e...

Page 1 of 1