Project

General

Profile

« Previous | Next » 

Revision 10045

lib/sh/util.sh: added sys_cmd(), which runs a system command and allows running a system command of the same name as the script

View differences:

util.sh
119 119
alias_append() { eval $(alias "$1")'"$2"'; } # usage: alias_append alias '; cmd'
120 120

  
121 121

  
122
#### commands
123

  
124
# makes command in $1 a system command
125
# allows running a system command of the same name as the script
126
alias cmd2sys="$(cat <<'EOF'
127
declare _1="$1"; shift
128
_1="$(indent; log++; echo_builtin command -p which "$_1"|echo_stdout)" || return
129
set -- "$_1" "$@"
130
EOF
131
)"
132

  
133
fi # load new aliases
134
if self_being_included; then
135

  
136
sys_cmd() { cmd2sys; command "$@"; } # usage: sys_cmd cmd... # runs system cmd
137
	# allows running a system command of the same name as the script
138

  
139

  
122 140
#### functions
123 141

  
124 142
kw_params() # usage: func() { kw_params param_var...; }; ...; param_var=... cmd

Also available in: Unified diff