aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLAN-TW <lantw44@gmail.com>2013-11-30 21:47:39 +0800
committerLAN-TW <lantw44@gmail.com>2013-11-30 21:47:39 +0800
commita64a9be29166f10f30c63d38b47c52903c7fb9b5 (patch)
tree980aa0d22e9be82b58c1c5a8e7fe9151a66cdea3
parentad7b38a4fa9bb990e899c892bb953a91d2ac13f8 (diff)
downloadconfigfile-a64a9be29166f10f30c63d38b47c52903c7fb9b5.tar.gz
configfile-a64a9be29166f10f30c63d38b47c52903c7fb9b5.tar.zst
configfile-a64a9be29166f10f30c63d38b47c52903c7fb9b5.zip
bash_include: 用 command 取代 \ 並修正一些指令歷史紀錄的問題
-rw-r--r--bash_include15
1 files changed, 9 insertions, 6 deletions
diff --git a/bash_include b/bash_include
index 60164b3..a5fa088 100644
--- a/bash_include
+++ b/bash_include
@@ -478,7 +478,7 @@ function prehistory_backup ()
echo "+$[$currentcount-$previoushistorycount])"
fi
echo "$currentcount" > "$historycountfile"
- \cp -f "$HISTFILE" "$historybackupfile"
+ command cp -f "$HISTFILE" "$historybackupfile"
}
########## Trash Manager ##########
@@ -591,7 +591,7 @@ function trash_recover ()
if [ "$?" = "0" ]
then
echo "Remove: $oneline"
- \rm -rf "$oneline"
+ command rm -rf "$oneline"
fi
done
}
@@ -1221,6 +1221,7 @@ function backup_file ()
j=$j+1
continue
else
+ history -s "$FUNCNAME" "$@"
"${prefixlist[@]}" \cp -p "${arglist[$i]}" "$rootfilename.$j"
history -s "${prefixlist[@]}" \cp -p "${arglist[$i]}" "$rootfilename.$j"
"${prefixlist[@]}" touch -r "${arglist[$i]}" "$rootfilename.$j"
@@ -1234,8 +1235,9 @@ function backup_file ()
printf "\e[1;33mPlease delete some backup file because I only use 0 - 9.\e[m\n"
fi
else
- "${prefixlist[@]}" \cp -p "${arglist[$i]}" "$rootfilename"
- history -s "${prefixlist[@]}" \cp -p "${arglist[$i]}" "$rootfilename"
+ history -s "$FUNCNAME" "$@"
+ "${prefixlist[@]}" cp -p "${arglist[$i]}" "$rootfilename"
+ history -s "${prefixlist[@]}" cp -p "${arglist[$i]}" "$rootfilename"
"${prefixlist[@]}" touch -r "${arglist[$i]}" "$rootfilename"
history -s "${prefixlist[@]}" touch -r "${arglist[$i]}" "$rootfilename"
fi
@@ -1264,8 +1266,8 @@ function get_memory_info ()
{
case "`uname`" in
"Linux"|"GNU")
- local meminfoline="`free -m | \grep -i mem`"
- local swapinfoline="`free -m | \grep -i swap`"
+ local meminfoline="`free -m | command grep -i mem`"
+ local swapinfoline="`free -m | command grep -i swap`"
local memtotal="`echo "$meminfoline" | awk '{print $2}'`"
local memused="`echo "$meminfoline" | awk '{print $3}'`"
local membuf="`echo "$meminfoline" | awk '{print $6}'`"
@@ -1352,6 +1354,7 @@ function mvfile ()
read -p "New name: " -e -i "${arglist[$i]}" new_file_name
if [ "$new_file_name" ] && [ "${arglist[$i]}" != "$new_file_name" ]
then
+ history -s "$FUNCNAME" "$@"
"${prefixlist[@]}" mv -iv "${arglist[$i]}" "$new_file_name"
history -s "${prefixlist[@]}" mv -iv "${arglist[$i]}" "$new_file_name"
fi