I am reading the source code for RVM(RVM), which uses the command __rvm_sed, but I cannot find a definition of __rvm_sed in the source code. Can someone help with that?
After peeking at the source code on Gitlab, it looks like __rvm_sed
is defined in the file scripts/functions/support
:
line
281 __rvm_setup_utils_functions
line
175 __rvm_setup_utils_functions()
176 {
177 \typeset gnu_tools_path gnu_prefix gnu_util
178 \typeset -a gnu_utils gnu_missing
179 gnu_utils=( awk cp date find sed tail tar xargs )
180 gnu_missing=()
181
182 if is_a_function __rvm_setup_utils_functions_${_system_name}
183 then __rvm_setup_utils_functions_${_system_name} "$@" || return $?
184 else __rvm_setup_utils_functions_Other "$@" || return $?
185 fi
186 }
_system_name
is (seemingly) defined in scripts/functions/detect/system
, and can take one of the following values:
So the script will try to invoke __rvm_setup_utils_functions_${_system_name}
if that function exists, or fallback to __rvm_setup_utils_functions_Other "$@"
...
line
252 __rvm_setup_utils_functions_Other()
253 {
254 __rvm_stat() { \command \stat "$@" || return $?; }
255 __rvm_setup_utils_functions_common
256 }
... which in turn invokes __rvm_setup_utils_functions_common
:
line
258 __rvm_setup_utils_functions_common()
259 {
(... snip ...)
276 for gnu_util in "${gnu_utils[@]}"
277 do eval "__rvm_$gnu_util() { \\$gnu_util \"\$@\" || return \$?; }"
278 done
279 }
So when $gnu_util
is sed
, function __rvm_sed()
is { \sed "$@" || return $?; }
Hope that helps.