Browse Source

.bashrc: enable catclip and setclip using xclip on ubuntu. they also work on cygwin if iscygwin is properly defined.

pull/1/head
10sr 13 years ago
parent
commit
a6ef9ca5de
1 changed files with 26 additions and 19 deletions
  1. +26
    -19
      .bashrc

+ 26
- 19
.bashrc View File

@@ -42,12 +42,30 @@ alias pacome="sudo \paco -D"
# type trash >/dev/null 2>&1 && alias rm=trash # type trash >/dev/null 2>&1 && alias rm=trash


catclip(){ catclip(){
:
if iscygwin
then
cat /dev/clipboard | tr -d \\r
else
xclip -o
fi
} }
setclip(){ setclip(){
if test $# -eq 0
if iscygwin
then then
:
if test $# -eq 0
then
sed -e 's/$/\r/' | tee /dev/clipboard
else
cat "$@" | sed -e 's/$/\r/' | tee /dev/clipboard
fi
else
if test $# -eq 0
then
xclip -i -f -selection "primary" | xclip -i -selection "clipboard"
else
cat "$@" | xclip -i -f -selection "primary" | xclip -i -selection "clipboard"
fi
fi
} }
p(){ p(){
"$@" | $PAGER "$@" | $PAGER
@@ -214,11 +232,11 @@ iswindows(){
} }


ismsys(){ ismsys(){
:
return 1
} }


iscygwin(){ iscygwin(){
:
return 1
} }


isdarwin(){ isdarwin(){
@@ -241,20 +259,10 @@ winln(){
} }


######################## ########################
if [ "${CYGWIN}" = "t" ]; then # cygwin判定ってどうやるんだろ 多分unameとか使う
if iscygwin; then # cygwin判定ってどうやるんだろ 多分unameとか使う
# for cygwin # for cygwin
export TMP=/tmp export TMP=/tmp
export TEMP=/tmp export TEMP=/tmp
catclip(){
cat /dev/clipboard | tr -d \\r
}
setclip(){
if [ $# -eq 0 ]; then # 引数があるかを判定
sed -e 's/$/\r/' | tee /dev/clipboard
else
cat $1 | sed -e 's/$/\r/' | tee /dev/clipboard
fi
}
# alias setclip="tee /dev/clipboard" # alias setclip="tee /dev/clipboard"
# alias catclip="cat /dev/clipboard | tr -d \\r" # alias catclip="cat /dev/clipboard | tr -d \\r"
alias cygsu="cygstart /cygwinsetup.exe" alias cygsu="cygstart /cygwinsetup.exe"
@@ -262,13 +270,12 @@ if [ "${CYGWIN}" = "t" ]; then # cygwin判定ってどうやるんだろ 多分
echo "cygwin bash" echo "cygwin bash"
fi fi


echo "Japanese letters are 表示可能"

####################### #######################


echo "Japanese letters are 表示可能"

safe-cmd diskinfo safe-cmd diskinfo


safe-cmd finger $USER safe-cmd finger $USER
LANG=C safe-cmd id LANG=C safe-cmd id




Loading…
Cancel
Save