File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ tk_exit_if_fail() {
2020# $(tk_join , "${ary[@]}")
2121# => "a,bb,ccc"
2222tk_join () {
23- local IFS=" $1 "
23+ local IFS=" ${1 :- } "
2424 shift
2525 echo " $* "
2626}
@@ -31,19 +31,19 @@ tk_join() {
3131tk_trim () {
3232 # Adapted from
3333 # https://github.com/dylanaraps/pure-bash-bible#trim-leading-and-trailing-white-space-from-string
34- local tmp=$1
34+ local tmp=${1 :- }
3535 tmp=${tmp# " ${tmp%% [![:space:]]* } " }
3636 tmp=${tmp% " ${tmp##* [![:space:]]} " }
3737 printf ' %s\n' " $tmp "
3838}
3939
4040tk_cmd_exist () {
41- [[ -z $1 ]] && tk_print_error " tk_cmd_exist(): expects command name as the parameter" && return 1
41+ [[ -z ${1 :- } ]] && tk_print_error " tk_cmd_exist(): expects command name as the parameter" && return 1
4242 command -v " $1 " & > /dev/null
4343}
4444
4545tk_fn_exist () {
46- [[ -z $1 ]] && tk_print_error " tk_fn_exist(): expects function name as the parameter" && return 1
46+ [[ -z ${1 :- } ]] && tk_print_error " tk_fn_exist(): expects function name as the parameter" && return 1
4747 [[ $( type -t " $1 " ) == " function" ]]
4848}
4949
@@ -52,7 +52,7 @@ tk_is_login_shell() {
5252}
5353
5454tk_version_in_path () {
55- [[ -z $1 ]] && tk_print_error " tk_version_in_path(): expects path as the parameter" && return 1
55+ [[ -z ${1 :- } ]] && tk_print_error " tk_version_in_path(): expects path as the parameter" && return 1
5656 if [[ $1 =~ [/-]([[:digit:]]+ (\. [[:digit:]]+)* ) ]]; then
5757 echo " ${BASH_REMATCH[1]} "
5858 fi
You can’t perform that action at this time.
0 commit comments