exaなかなかおしゃれっすね!
ls よりも exa を使おう!モダンな Linux コマンド達を紹介 - Qiita
カラフルでいいですね。
黒地に白文字オンリーの色のない生活は嫌です。
でも... lsと互換じゃないところがある!
ということでbashrcに追記。
if [[ "${-/i/}" = "$-" ]] ; then
if [[ -x $HOME/.cargo/bin/exa ]] ;then
function ls {
if [ ! -t 1 ] ; then
#パイプされているので互換性のために
command ls "$@"
return
fi
local OPT=`getopt -o Sa1ltrd --long all,help,oneline -- "$@"`
if [ $? != 0 ] ; then
echo "use the ls, Luke" >&2
return 2
fi
eval set -- "$OPT"
local newopt=("--time-style" "long-iso" "--icons" "--classify")
local witht=""
local withr=""
local withS=""
while true ; do
case "$1" in
-t)
witht=1
shift
;;
-r)
withr=1
shift
;;
-S)
withS=1
shift
;;
--)
shift
break
;;
-*)
newopt=("${newopt[@]}" "$1")
shift
;;
*)
break
;;
esac
done
newopt=("${newopt[@]}" "$@")
if [[ $withS && $withr ]]; then
newopt=("${newopt[@]}" "--sort" "size" "--group-directories-first")
elif [[ $withS ]]; then
newopt=("${newopt[@]}" "--sort" "size" "-r" "--group-directories-first")
elif [[ $witht && $withr ]]; then
newopt=("${newopt[@]}" "--sort" "oldest")
elif [[ $witht ]] ;then
newopt=("${newopt[@]}" "--sort" "newest")
elif [[ $withr ]] ;then
newopt=("${newopt[@]}" "-r")
fi
$HOME/.cargo/bin/exa "${newopt[@]}"
}
fi
fi
cshから引っ越して何年たったかわかりませんが(老害発言)、bashrcが肥大化しすぎてzshへの引っ越しが全然すすまないという悲しみ。
ということで、たまには小ネタ投稿でした。