-->

2012-10-08

メモ: bashのalias

ログイン後にaliasを実行するのは大変なのかもしれない。
ログイン先の~/.bashrcなどを変更できない場合。

http://d.hatena.ne.jp/sodomojo/20081120/1227213620
http://kakakikikeke.blogspot.jp/2012/08/poderosassh.html

~/.ssh/config LocalCommand

bind '"\C-n": history-search-forward'
bind '"\C-p": history-search-backward'

alias ls='ls -A -T0 -N -C -F --color=auto --time-style="+%Y-%m-%d %H:%M:%S"'
alias ll='ls -l'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias enman='LANG=C LC_ALL=C PATH="/usr/bin:/bin" man'
alias mydate='date +%Y-%m-%d'
if [ -z "`which lv 2>/dev/null`" ]; then alias lv='less'; fi

    mycp(){ SRC=$1;\
if test ! -e "${SRC}";then echo "\"${SRC}\" does not exist.";return 1;fi;\
DIST=`pwd`"/"`basename $1`.`date --reference "${SRC}" +%Y-%m-%d_%H%M%S`;\
if test -e "${DIST}";then echo "\"${DIST}\" is exist.";return 1;fi;\
cp -ai "${SRC}" "${DIST}";}
    mymv(){ SRC=$1;\
if test ! -e "${SRC}";then echo "\"${SRC}\" does not exist.";return 1;fi;\
DIST=`pwd`"/"`basename $1`.`date --reference "${SRC}" +%Y-%m-%d_%H%M%S`;\
if test -e "${DIST}";then echo "\"${DIST}\" is exist.";return 1;fi;\
mv -i "${SRC}" "${DIST}";}

0 件のコメント: