mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
aliases/general(cp,mv,mkdir): Fix command-not-found by expanded aliases in functions
This commit is contained in:
@@ -25,30 +25,27 @@
|
|||||||
# Ref. https://github.com/ohmybash/oh-my-bash/issues/351
|
# Ref. https://github.com/ohmybash/oh-my-bash/issues/351
|
||||||
function _omb_alias_general_cp_init {
|
function _omb_alias_general_cp_init {
|
||||||
if (tmp=$(_omb_util_mktemp); trap 'rm -f "$tmp"{,.2}' EXIT; command cp -v "$tmp" "$tmp.2" &>/dev/null); then
|
if (tmp=$(_omb_util_mktemp); trap 'rm -f "$tmp"{,.2}' EXIT; command cp -v "$tmp" "$tmp.2" &>/dev/null); then
|
||||||
alias cp='cp -iv' && unset -f "$FUNCNAME"
|
alias cp='cp -iv' && function _omb_alias_general_cp_init { command cp -iv "$@"; }
|
||||||
command cp -iv "$@"
|
|
||||||
else
|
else
|
||||||
alias cp='cp -i' && unset -f "$FUNCNAME"
|
alias cp='cp -i' && function _omb_alias_general_cp_init { command cp -i "$@"; }
|
||||||
command cp -i "$@"
|
fi &&
|
||||||
fi
|
_omb_alias_general_cp_init "$@"
|
||||||
}
|
}
|
||||||
function _omb_alias_general_mv_init {
|
function _omb_alias_general_mv_init {
|
||||||
if (tmp=$(_omb_util_mktemp); trap 'rm -f "$tmp.2"' EXIT; command mv -v "$tmp" "$tmp.2" &>/dev/null); then
|
if (tmp=$(_omb_util_mktemp); trap 'rm -f "$tmp.2"' EXIT; command mv -v "$tmp" "$tmp.2" &>/dev/null); then
|
||||||
alias mv='mv -iv' && unset -f "$FUNCNAME"
|
alias mv='mv -iv' && function _omb_alias_general_mv_init { command mv -iv "$@"; }
|
||||||
command mv -iv "$@"
|
|
||||||
else
|
else
|
||||||
alias mv='mv -i' && unset -f "$FUNCNAME"
|
alias mv='mv -i' && function _omb_alias_general_mv_init { command mv -i "$@"; }
|
||||||
command mv -i "$@"
|
fi &&
|
||||||
fi
|
_omb_alias_general_mv_init "$@"
|
||||||
}
|
}
|
||||||
function _omb_alias_general_mkdir_init {
|
function _omb_alias_general_mkdir_init {
|
||||||
if command mkdir -pv . &>/dev/null; then
|
if command mkdir -pv . &>/dev/null; then
|
||||||
alias mkdir='mkdir -pv' && unset -f "$FUNCNAME"
|
alias mkdir='mkdir -pv' && function _omb_alias_general_mkdir_init { command mkdir -pv "$@"; }
|
||||||
command mkdir -pv "$@"
|
|
||||||
else
|
else
|
||||||
alias mkdir='mkdir -p' && unset -f "$FUNCNAME"
|
alias mkdir='mkdir -p' && function _omb_alias_general_mkdir_init { command mkdir -p "$@"; }
|
||||||
command mkdir -p "$@"
|
fi &&
|
||||||
fi
|
_omb_alias_general_mkdir_init "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
alias cp='_omb_alias_general_cp_init' # Preferred 'cp' implementation
|
alias cp='_omb_alias_general_cp_init' # Preferred 'cp' implementation
|
||||||
|
Reference in New Issue
Block a user