'
gsu_check_arg_count $# 1 1
- if (($ret < 0)); then
+ if ((ret < 0)); then
gsu_err_msg
exit 1
fi
result="local _gsu_getopts_opt"
for ((i=0; i < ${#1}; i++)); do
c1=${1:$i:1}
- c2=${1:$(($i + 1)):1}
+ c2=${1:$((i + 1)):1}
result+=" o_$c1="
if [[ "$c2" = ":" ]]; then
let i++
"
for ((i=0; i < ${#1}; i++)); do
c1=${1:$i:1}
- c2=${1:$(($i + 1)):1}
+ c2=${1:$((i + 1)):1}
result+="$tab$tab$c1) o_$c1="
if [[ "$c2" = ":" ]]; then
result+="\"\$OPTARG\""
for cmd in $cmds; do
printf '%s' "$cmd"
let ++count
- if (($count % 4)); then
+ if ((count % 4)); then
printf '\t'
((${#cmd} < 8)) && printf '\t'
else
gsu_getopts "$com_prefs_options"
eval "$result"
- (($ret < 0)) && return
+ ((ret < 0)) && return
gsu_check_arg_count $# 0 0
- (($ret < 0)) && return
+ ((ret < 0)) && return
if [[ "$o_e" == "true" ]]; then
ret=-$E_GSU_MKDIR
_gsu_available_commands
for com in $result; do
num=${#com}
- (($num < 4)) && num=4
+ ((num < 4)) && num=4
echo "${minus_signs:0:$num}"
echo "$com"
echo "${minus_signs:0:$num}"
cword="$1"
gsu_is_a_number "$cword"
- (($ret < 0)) && return
- if (($cword <= 1)); then
+ ((ret < 0)) && return
+ if ((cword <= 1)); then
_gsu_available_commands
echo "${result}"
ret=$GSU_SUCCESS
local -a words
result=
- (($cword == 0)) && return
+ ((cword == 0)) && return
((${#opts} < 2)) && return
shift 2
words=("$@")
- prev="${words[$(($cword - 1))]}"
+ prev="${words[$((cword - 1))]}"
[[ ! "$prev" == -* ]] && return
n=$((${#opts} - 1))
for ((i=0; i <= $n; i++)); do
opt="${opts:$i:1}"
- [[ "${opts:$(($i + 1)):1}" != ":" ]] && continue
+ [[ "${opts:$((i + 1)):1}" != ":" ]] && continue
let i++
[[ ! "$prev" =~ ^-.*$opt$ ]] && continue
result="$opt"
shift 2
words=("$@")
cur="${words[$cword]}"
- prev="${words[$(($cword - 1))]}"
+ prev="${words[$((cword - 1))]}"
result=-1
[[ "$cur" == -* ]] && return
[[ "$prev" == -* ]] && [[ "$opts" == *${prev#-}:* ]] && return
for ((i=1; i <= $cword; i++)); do
- prev="${words[$(($i - 1))]}"
+ prev="${words[$((i - 1))]}"
cur="${words[$i]}"
[[ "$cur" == -* ]] && continue
if [[ "$prev" == -* ]]; then
fi
let n++
done
- result="$(($n - 1))"
+ result="$((n - 1))"
}
# Entry point for all gsu-based scripts.
shift
if [[ "$(type -t "com_$arg")" == 'function' ]]; then
"com_$arg" "$@"
- if (("$ret" < 0)); then
+ if ((ret < 0)); then
gsu_err_msg
exit 1
fi