You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

782 lines
19 KiB

  1. #!/bin/bash
  2. # If not running interactively, don't do anything
  3. [[ $- != *i* ]] && return
  4. ##########################################
  5. null(){
  6. "$@" >/dev/null 2>&1
  7. }
  8. __try_exec(){
  9. type $1 >/dev/null 2>&1 && "$@"
  10. }
  11. ##########################
  12. # system type
  13. alias ismsys=false
  14. alias iscygwin=false
  15. alias iswindows=false
  16. alias isdarwin=false
  17. alias islinux=false
  18. alias with_coreutils=false # for mac
  19. case `uname` in
  20. (MINGW*) alias ismsys=true ;;
  21. (CYGWIN*) alias iscygwin=true ;;
  22. (Darwin*) alias isdarwin=true ;;
  23. (Linux*) alias islinux=true ;;
  24. esac
  25. null ls --version && alias with_coreutils=true
  26. ( ismsys || iscygwin ) && alias iswindows=true
  27. #################################
  28. if false iswindows
  29. then
  30. export PAGER='tr -d \\r | less'
  31. else
  32. export PAGER="less"
  33. fi
  34. export LESS="-iRMX"
  35. if null type vim
  36. then
  37. export EDITOR=vim
  38. else
  39. export EDITOR=vi
  40. fi
  41. export LANG=ja_JP.UTF-8
  42. export LC_MESSAGES=C
  43. # export CDPATH=".:~"
  44. export VISUAL="$EDITOR"
  45. export GIT_PAGER="less -F"
  46. export GIT_EDITOR="$EDITOR"
  47. if test -n "$TMUX" && \
  48. echo $TERM | grep screen >/dev/null 2>&1 && \
  49. tmux display -p '#{client_termname}' | grep 256color >/dev/null 2>&1
  50. then
  51. TERM=screen-256color
  52. fi
  53. test -z "$TMP" && export TMP=/tmp/${USER}-tmp
  54. mkdir -p "$TMP"
  55. ! iswindows && null type stty && {
  56. stty stop undef # unbind C-s to stop displaying output
  57. # stty erase '^h'
  58. }
  59. if iswindows; then
  60. # export PS1=" \[\e[32m\]\u@\H \[\e[33m\]\w\[\e[0m\] \d \t\n\s \# \j \$ "
  61. # export PS1=" [\[\e[33m\]\w\[\e[0m\]]\n\[\e[32m\]\u@\H\[\e[0m\] \d \t \s.\v\nhist:\# jobs:\j \$ "
  62. export USER=$USERNAME
  63. fi
  64. _tmux_prefs(){
  65. null type tmux || return 1
  66. tmux set -g mode-keys vi
  67. }
  68. if test -d ~/dbx
  69. then
  70. export CHIT_PATH="$HOME/dbx/.chit"
  71. fi
  72. #######################
  73. iswindows && alias tty="echo cmd.exe"
  74. type fortune >/dev/null 2>&1 && {
  75. fortune
  76. echo
  77. fortune -o
  78. echo
  79. }
  80. uname -a
  81. echo TERM $TERM $(tput colors) colors connected to $(tty), \
  82. running $BASH $BASH_VERSION
  83. if test -n "$TMUX"
  84. then
  85. tmux display -p 'Using tmux #S:#I:#W.#P, client is #{client_termname}' \
  86. 2>/dev/null
  87. echo
  88. fi
  89. ###################################
  90. # some aliases and functions
  91. ( ! with_coreutils && isdarwin ) || test "$TERM" == dumb || \
  92. _coloroption=" --color=auto"
  93. ( ! with_coreutils && isdarwin ) || iswindows || \
  94. _timeoption=" --time-style=long-iso"
  95. ( ! with_coreutils && isdarwin ) || _hideoption=" --hide=[A-Z]*" # do not use
  96. _timeformat_iso="%Y-%m-%dT%H:%M:%S%z"
  97. _timeformat_rfc2822="%a, %d %b %Y %T %z"
  98. alias ls="ls -hCF${_coloroption}${_timeoption}"
  99. # export GREP_OPTIONS=""
  100. alias gr="grep -n --color=always"
  101. iswindows && alias grep="grep -n"
  102. # alias ll="ls -l"
  103. # alias la="ls -A"
  104. # alias lla="ls -Al"
  105. alias less="less -F"
  106. alias em="emacs -nw"
  107. null type vim && alias vi=vim
  108. alias pstree="LANG=C pstree"
  109. alias cp="cp -v"
  110. alias mv="mv -v"
  111. alias rm="rm -v"
  112. alias psaux="ps auxww"
  113. alias q=exit
  114. alias e3=e3em
  115. #alias dirs="dirs -v -l | \grep -v \$(printf '%s$' \$PWD)"
  116. alias po=popd
  117. alias pu=pushd
  118. alias sudo="sudo " # use aliases through sudo
  119. alias sudoe="sudoedit"
  120. alias halt="sudo halt"
  121. alias reboot="sudo reboot"
  122. alias suspend="dbus-send --system --print-reply --dest=org.freedesktop.UPower \
  123. /org/freedesktop/UPower org.freedesktop.UPower.Suspend"
  124. alias hibernate="dbus-send --system --print-reply --dest=org.freedesktop.UPower \
  125. /org/freedesktop/UPower org.freedesktop.UPower.Hibernate"
  126. alias rand="echo \$RANDOM"
  127. alias xunp="file-roller -h"
  128. alias pc="sudo \paco -D"
  129. alias pycalc="python -i -c 'from math import *' "
  130. alias py3=python3
  131. alias py2=python2
  132. alias _reloadrc="test -f ~/.bashrc && source ~/.bashrc"
  133. # alias mytime="date +%Y%m%d-%H%M%S"
  134. alias sh="ENV=$HOME/.shrc PS1=\$\ PROMPT_COMMAND="" sh"
  135. # type trash >/dev/null 2>&1 && alias rm=trash
  136. alias mpg123="mpg123 -C -v --title"
  137. alias xm="xmms2"
  138. #export PLAYER="mpg123 -C -v --title"
  139. null type screen && alias screen="screen -e^z^z"
  140. #alias zcd="cd \`zenity --file-selection --directory\`"
  141. null type gtags && alias gtags="gtags --verbose"
  142. null type htags && alias htags="htags --xhtml --symbol --line-number \
  143. --frame --alphabet --verbose"
  144. null type aunpack && alias aunp=aunpack
  145. null type lv && alias lv="lv|less"
  146. isdarwin && alias updatedb="LC_ALL=C updatedb"
  147. # pad
  148. alias pad=notepad
  149. null type gedit && alias pad=gedit
  150. null type leafpad && alias pad=leafpad
  151. isdarwin && alias pad="open -e"
  152. alias wic=wicd-curses
  153. alias wil="wicd-cli -y -l | head"
  154. #alias wicn="wicd-cli -y -c -n"
  155. wicn(){
  156. if test $# -eq 0
  157. then
  158. local num
  159. wicd-cli -y -l | head
  160. echo -n "input num: "
  161. read num
  162. test -n "$num" && wicd-cli -y -c -n $num
  163. else
  164. wicd-cli -y -c -n $1
  165. fi
  166. }
  167. alias aptin="apt-get install"
  168. alias aptsearch="apt-cache search"
  169. alias aptshow="apt-cache show"
  170. for f in /usr/share/vim/vimcurrent/macros/less.sh \
  171. /usr/share/vim/vim73/macros/less.sh \
  172. /usr/share/vim/vim72/macros/less.sh
  173. do
  174. test -f $f && alias vl=$f && break
  175. done
  176. alias yt=yaourt
  177. null type pacman-color && {
  178. alias pacman=pacman-color
  179. export pacman_program=pacman-color # used by pacmatic
  180. export PACMAN=pacman-color # used by yaourt
  181. }
  182. null type pacmatic && {
  183. alias pacman="pacmatic"
  184. export PACMAN="pacmatic"
  185. }
  186. null type apt-get && \
  187. alias aupgrade="sudo apt-get autoremove --yes && \
  188. sudo apt-get update --yes && sudo apt-get upgrade --yes"
  189. null type port && \
  190. alias port="port -v"
  191. alias pupgrade="sudo port -v selfupdate && \
  192. { sudo port -v upgrade outdated; }"
  193. if iscygwin; then
  194. null type windate || \
  195. alias windate="/c/Windows/System32/cmd.exe //c 'echo %DATE%-%TIME%'"
  196. alias cygsu="cygstart /cygwinsetup.exe"
  197. alias emacs="CYGWIN=tty emacs -nw"
  198. alias ls="ls -CFG $(iswindows || test "$TERM" = dumb || echo --color=auto)"
  199. fi
  200. g(){
  201. if test $# -eq 0 && null type git-info
  202. then
  203. git info
  204. else
  205. git "$@"
  206. fi
  207. }
  208. if null type _git
  209. then
  210. # enable programmable completion for g
  211. complete -o bashdefault -o default -o nospace -F _git g 2>/dev/null \
  212. || complete -o default -o nospace -F _git g
  213. fi
  214. alias setup.py="sudo python3 setup.py install --record files.txt"
  215. man() {
  216. env \
  217. LESS_TERMCAP_mb=$(printf "\e[1;35m") \
  218. LESS_TERMCAP_md=$(printf "\e[1;31m") \
  219. LESS_TERMCAP_me=$(printf "\e[0m") \
  220. LESS_TERMCAP_se=$(printf "\e[0m") \
  221. LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
  222. LESS_TERMCAP_ue=$(printf "\e[0m") \
  223. LESS_TERMCAP_us=$(printf "\e[1;32m") \
  224. man "$@"
  225. }
  226. scr(){
  227. _tformat="%Y%m%d-%H%M%S%z"
  228. _file=`date +${_tformat}`.script
  229. SCRIPT=${_file} script ${_file} "$@"
  230. }
  231. netwait(){
  232. while ! ping -c 1 -t 1 example.com
  233. do
  234. true
  235. done
  236. echo network works.
  237. }
  238. cd(){
  239. if test $# -eq 0
  240. then
  241. pushd ~/ >/dev/null
  242. elif test $1 = -
  243. then
  244. local pwd="$PWD"
  245. command cd $OLDPWD
  246. pushd -n "$pwd" >/dev/null # stack last dir
  247. elif ! test -d "$1"
  248. then
  249. echo `basename ${SHELL}`: cd: "$1": No such file or directory 1>&2
  250. return 1
  251. else
  252. pushd "$1" >/dev/null
  253. fi
  254. __dirs_rm_dup "$PWD"
  255. echo "$PWD"
  256. }
  257. __dirs_rm_dup(){
  258. for d in "$@"
  259. do
  260. local next="$(__realpath --strip "$d")"
  261. for l in $(\dirs -v -l | cut -d $'\n' -f 2- | \
  262. \grep -x " *[0-9]\+ \+${next}" | \grep -o "^ *[0-9]\+ " | tac)
  263. do
  264. popd +$l -n >/dev/null
  265. done
  266. done
  267. }
  268. __realpath(){
  269. if type realpath >/dev/null 2>&1
  270. then
  271. command realpath "$@"
  272. else
  273. while ! test -d $1
  274. do
  275. shift
  276. done
  277. local d="$OLDPWD"
  278. command cd "$1"
  279. echo "$PWD"
  280. command cd "$d"
  281. fi
  282. }
  283. dh(){
  284. if test $# -eq 0
  285. then
  286. dirs -v -l
  287. else
  288. local dir="$(dirs -v -l | \grep "^ *$1 \+" | sed "s/^ *[0-9]* *//g")"
  289. cd "$dir"
  290. fi
  291. }
  292. input(){
  293. local foo
  294. stty -echo
  295. read foo
  296. stty echo
  297. echo $foo
  298. }
  299. tmux(){
  300. if test $# -eq 0
  301. then
  302. (cd ~; command tmux start;)
  303. if command tmux has -t main
  304. then
  305. command tmux attach -t main
  306. else
  307. (cd ~; command tmux new -s main;)
  308. fi
  309. else
  310. command tmux "$@"
  311. fi
  312. }
  313. mcrypt-stream(){
  314. test $# -eq 2 || return 1
  315. case $1 in
  316. en)
  317. mcrypt --key $2 | base64 ;;
  318. de)
  319. base64 -d | mcrypt -d --key $2 ;;
  320. esac
  321. }
  322. gpg-stream(){
  323. test $# -eq 2 || return 1
  324. case $1 in
  325. en)
  326. gpg --passphrase $2 -c --batch |base64 ;;
  327. de)
  328. base64 -d|gpg --passphrase $2 -d --batch ;;
  329. esac
  330. }
  331. dgpg(){
  332. if test "$1" = help || test -z "$2"
  333. then
  334. echo "dgpg: dgpg <en|de> <src-suffix> [<dst-suffix>]" 1>&2
  335. return
  336. fi
  337. local srcs="$2"
  338. local dsts="$3"
  339. test -z "$dsts" && dsts="${srcs}.out"
  340. local pw
  341. echo -n "dgpg pw: "
  342. read -s pw
  343. echo ""
  344. test -z "$pw" && return 1
  345. for f in *${srcs}
  346. do
  347. local d="$(basename "$f" "${srcs}")${dsts}"
  348. echo -n "Processing $f to $d..."
  349. if test -d "$f"
  350. then
  351. echo "`printf 'failed (%s is directory)' $f`"
  352. elif test -f "$d"
  353. then
  354. echo "`printf 'failed (%s is already exists)' $d`"
  355. elif <"$f" gpg-stream $1 $pw >"$d" 2>/dev/null
  356. then
  357. echo "done"
  358. else
  359. echo "failed"
  360. test -f "$d" && rm "$d"
  361. fi
  362. done
  363. }
  364. alias enst="gpg-stream en"
  365. alias dest="gpg-stream de"
  366. showinfo(){
  367. echo "Japanese letters are 表示可能"
  368. __try_exec diskinfo
  369. ! isdarwin && test -n "${DISPLAY}" && {
  370. __try_exec xrandr | \grep --color=never ^Screen
  371. }
  372. iswindows || __try_exec finger $USER
  373. LANG=C __try_exec id
  374. __try_exec xset q
  375. }
  376. x(){
  377. if [[ -z $DISPLAY ]] && ! [[ -e /tmp/.X11-unix/X0 ]] && (( EUID )); then
  378. #mkdir -p ~/.my/log
  379. # nohup startx >~/.my/log/xorg.log 2>&1 &
  380. # exit
  381. exec startx
  382. else
  383. echo "X cant be started! Another X is already running?" 1>&2
  384. fi
  385. }
  386. bak(){
  387. for file in "$@"
  388. do
  389. cp -v ${file} ${file}.bak
  390. done
  391. }
  392. di(){
  393. if type colordiff >/dev/null 2>&1 && test $TERM != dumb
  394. then
  395. local diffcmd=colordiff
  396. else
  397. local diffcmd=diff
  398. fi
  399. ${diffcmd} -u "$@" | ${PAGER}
  400. }
  401. tb(){
  402. local tb="$HOME/.my/tb"
  403. mkdir -p "$tb"
  404. for file in "$@"
  405. do
  406. mv -t "$tb" "$file"
  407. done
  408. }
  409. mkcd(){
  410. mkdir -p $1
  411. cd $1
  412. }
  413. if test -n "$TMUX" && null type reattach-to-user-namespace
  414. then
  415. alias pbpaste="reattach-to-user-namespace pbpaste"
  416. alias pbcopy="reattach-to-user-namespace pbcopy"
  417. fi
  418. catclip(){
  419. if iswindows
  420. then
  421. cat /dev/clipboard | tr -d \\r
  422. elif isdarwin
  423. then
  424. pbpaste
  425. else
  426. xclip -o -selection "clipboard"
  427. fi
  428. }
  429. setclip(){
  430. if test $# -eq 0
  431. then
  432. exec 3<&0
  433. else
  434. exec 3<<__EOF__
  435. `cat "$@"`
  436. __EOF__
  437. fi
  438. if iswindows
  439. then
  440. 0<&3 sed -e 's/$/\r/' | tee /dev/clipboard
  441. elif isdarwin
  442. then
  443. pbcopy 0<&3
  444. else
  445. 0<&3 xclip -i -f -selection "primary" | \
  446. xclip -i -f -selection "clipboard"
  447. fi
  448. exec 3<&-
  449. }
  450. open_file(){
  451. if iswindows
  452. then
  453. cmd.exe //c start "" "$@"
  454. elif isdarwin
  455. then
  456. touch "$@"
  457. open "$@"
  458. elif islinux
  459. then
  460. touch "$@"
  461. if null type pcmanfm; then
  462. LC_MESSAGES= pcmanfm "$@"
  463. else
  464. LC_MESSAGES= xdg-open "$@" &
  465. fi
  466. else
  467. cat "$@"
  468. fi
  469. }
  470. o(){
  471. if test $# -eq 0
  472. then
  473. open_file .
  474. else
  475. for f in "$@"
  476. do
  477. open_file "$(realpath "$f")"
  478. done
  479. fi
  480. }
  481. convmv-sjis2utf8-test(){
  482. convmv -r -f sjis -t utf8 *
  483. }
  484. convmv-sjis2utf8-notest(){
  485. convmv -r -f sjis -t utf8 * --notest
  486. }
  487. #Change ANSI Colors
  488. _chengecolors(){
  489. echo -e \
  490. "\e]P0000000" \
  491. "\e]P1cd0000" \
  492. "\e]P200cd00" \
  493. "\e]P3cdcd00" \
  494. "\e]P41e90ff" \
  495. "\e]P5cd00cd" \
  496. "\e]P600cdcd" \
  497. "\e]P7353535" \
  498. "\e]P8666666" \
  499. "\e]P9ff9999" \
  500. "\e]Pa99ff99" \
  501. "\e]Pbffff99" \
  502. "\e]Pc9999ff" \
  503. "\e]Pdff99ff" \
  504. "\e]Pe99ffff" \
  505. "\e]Pfffffff"
  506. }
  507. # printf "\e]P7353535" \
  508. _colors(){
  509. echo -e \
  510. "\e[30mBlack" \
  511. "\e[31mRed" \
  512. "\e[32mGreen" \
  513. "\e[33mYellow" \
  514. "\e[34mBlue" \
  515. "\e[35mMagenta" \
  516. "\e[36mCyan" \
  517. "\e[37mWhite"
  518. echo -e \
  519. "\e[30;1mBright Black" \
  520. "\e[31;1mBright Red" \
  521. "\e[32;1mBright Green" \
  522. "\e[33;1mBright Yellow" \
  523. "\e[34;1mBright Blue" \
  524. "\e[35;1mBright Magenta" \
  525. "\e[36;1mBright Cyan" \
  526. "\e[37;1mBright White\n" \
  527. "\e[0m"
  528. }
  529. winln(){
  530. # for windose make link (actually junction)
  531. if test $# -eq 0
  532. then
  533. {
  534. echo "usage: winln TARGET LINK_NAME"
  535. echo "Create a link to TARGET with the name LINK_NAME \
  536. (that is, TARGET must already exist)."
  537. echo "About other features run 'junction'."
  538. } 1>&2
  539. return 1
  540. else
  541. junction "$2" "$1"
  542. fi
  543. }
  544. __my_moc_state(){
  545. type mocp >/dev/null 2>&1 || return
  546. test "`mocp -Q %state 2>/dev/null`" == PLAY || return
  547. printf "$1" "`mocp -Q %title 2>/dev/null`"
  548. }
  549. __my_parse_svn_branch() {
  550. local LANG=C
  551. local svn_url=$(svn info 2>/dev/null | sed -ne 's#^URL: ##p')
  552. local svn_repository_root=$(svn info 2>/dev/null | \
  553. sed -ne 's#^Repository Root: ##p')
  554. echo ${svn_url} | sed -e 's#^'"${svn_repository_root}"'##g' | \
  555. awk '{print $1}'
  556. }
  557. __my_svn_ps1(){
  558. if svn status >/dev/null 2>&1
  559. then
  560. local svn_branch=$(__my_parse_svn_branch)
  561. test -n "${svn_branch}" && printf "$1" "{$svn_branch}"
  562. fi
  563. }
  564. __my_battery_status(){
  565. local dir=/sys/class/power_supply/BAT0
  566. if test -d $dir && test -r $dir/status && test -r $dir/charge_full && \
  567. test -r $dir/charge_now
  568. then
  569. local st=$(cat $dir/status)
  570. local full=$(cat $dir/charge_full)
  571. local now=$(cat $dir/charge_now)
  572. local rate=$(expr $now \* 100 / $full)
  573. printf "$1" "${st}:${rate}%"
  574. fi
  575. }
  576. alias bat='__my_battery_status %s\\n'
  577. ip-address(){
  578. type ip >/dev/null 2>&1 || return 1
  579. local ip=$(LANG=C ip addr show scope global | \
  580. \grep --color=never --only-matching 'inet [^ ]*' | cut -d " " -f 2)
  581. test -n "$ip" && printf $1 $ip
  582. }
  583. __my_ps1_script(){
  584. local last=$?
  585. test -n "$SCRIPT" && echo "${__my_c5}SCR${__my_cdef} "
  586. return $last
  587. }
  588. __my_ps1_scale(){
  589. local last=$?
  590. echo "[LC:${LINES}x${COLUMNS}]"
  591. return $last
  592. }
  593. __my_ps1_tmux(){
  594. local last=$?
  595. null type tmux || return $last
  596. local tmuxc="$(tmux display -p '#S:#I:#W.#P' 2>/dev/null)"
  597. test -n "$TMUX" && echo "[TMUX:$tmuxc]"
  598. return $last
  599. }
  600. __my_ps1_moc(){
  601. local last=$?
  602. __my_moc_state "[MOC:%s]"
  603. return $last
  604. }
  605. for f in /usr/share/git/git-prompt.sh \
  606. /opt/local/share/doc/git-core/contrib/completion/git-prompt.sh
  607. do
  608. test -r $f && . $f && break
  609. done
  610. GIT_PS1_SHOWDIRTYSTATE=t
  611. GIT_PS1_SHOWUPSTREAM=t
  612. __my_ps1_git(){
  613. local last=$?
  614. null type __git_ps1 || return $last
  615. null __gitdir || return $last
  616. __git_ps1 "[GIT:$(__try_exec git config --get user.name):%s]"
  617. return $last
  618. }
  619. __my_ps1_ipaddr(){
  620. local last=$?
  621. ! iswindows && ip-address [Addr:%s]
  622. return $last
  623. }
  624. __my_ps1_bttry(){
  625. local last=$?
  626. local bst="${TMP}/batterystatus"
  627. if test -z "$DISPLAY" && ! iswindows
  628. then
  629. test -f $bst && local bstr="$(cat $bst)"
  630. test -n "$bstr" && ! echo $bstr | grep 100 >/dev/null 2>&1 && \
  631. echo "[Battery:$bstr]"
  632. __my_battery_status %s >$bst &
  633. fi
  634. return $last
  635. }
  636. __my_ps1_dirs(){
  637. dirs | wc -l
  638. }
  639. __my_ps1_jobs(){
  640. jobs | wc -l
  641. }
  642. if test "$TERM" != dumb
  643. then
  644. __my_c1="\[\e[1;31m\]" # color for PWD
  645. __my_c2="\[\e[0;36m\]" # color for user
  646. __my_c3="\[\e[1;30m\]" # color for OLDPWD
  647. if test "`hostname`" = arch-aspireone; then __my_c4="\[\e[1;34m\]"
  648. elif test "`hostname`" = darwin-mba.local; then __my_c4="\[\e[1;33m\]"
  649. elif test "`hostname`" = newkiwi; then __my_c4="\[\e[1;35m\]"
  650. else __my_c4="\[\e[1;32m\]" # color for ::
  651. fi
  652. __my_c5="\[\e[30;47m\]" # color for SCR
  653. __my_cdef="\[\e[0m\]"
  654. fi
  655. _PS1="\
  656. ${__my_c4}:: ${__my_cdef}[${__my_c2}\u@\H${__my_cdef}:${__my_c1}\w/${__my_cdef}]\$(__my_ps1_scale)\$(__my_ps1_git)\$(__my_ps1_bttry)\$(__my_ps1_ipaddr)\$(__my_ps1_moc)\n\
  657. ${__my_c4}:: ${__my_cdef}l${SHLVL}n\#j\js\$? \D{%T} $(__my_ps1_script)\$ "
  658. PS1=$_PS1
  659. __my_set_title(){
  660. title="$(echo $@)"
  661. case $TERM in
  662. (rxvt*|xterm*|aterm|screen*)
  663. test -t 1 &&
  664. test -n "$DISPLAY" &&
  665. test -z "$EMACS" &&
  666. echo -n -e "\033]0;${title}\007"
  667. ;;
  668. esac
  669. }
  670. PROMPT_COMMAND="__my_set_title \${USER}@\${HOSTNAME}\ \${PWD}"
  671. # copied from https://wiki.archlinux.org/index.php/X_resources
  672. invader(){
  673. # ANSI color scheme script featuring Space Invaders
  674. #
  675. # Original: http://crunchbanglinux.org/forums/post/126921/#p126921
  676. # Modified by lolilolicon
  677. #
  678. f=3 b=4
  679. for j in f b; do
  680. for i in {0..7}; do
  681. printf -v $j$i %b "\e[${!j}${i}m"
  682. done
  683. done
  684. bld=$'\e[1m'
  685. rst=$'\e[0m'
  686. cat << EOF
  687. $f1 ▀▄ ▄▀ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4 ▀▄ ▄▀ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst
  688. $f1 ▄█▀███▀█▄ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4 ▄█▀███▀█▄ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst
  689. $f1█▀███████▀█ $f2▀▀███▀▀███▀▀ $f3▀█▀██▀█▀ $f4█▀███████▀█ $f5▀▀███▀▀███▀▀ $f6▀█▀██▀█▀$rst
  690. $f1▀ ▀▄▄ ▄▄▀ ▀ $f2 ▀█▄ ▀▀ ▄█▀ $f3▀▄ ▄▀ $f4▀ ▀▄▄ ▄▄▀ ▀ $f5 ▀█▄ ▀▀ ▄█▀ $f6▀▄ ▄▀$rst
  691. $bld$f1▄ ▀▄ ▄▀ ▄ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4▄ ▀▄ ▄▀ ▄ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst
  692. $bld$f1█▄█▀███▀█▄█ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4█▄█▀███▀█▄█ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst
  693. $bld$f1▀█████████▀ $f2▀▀▀██▀▀██▀▀▀ $f3▀▀█▀▀█▀▀ $f4▀█████████▀ $f5▀▀▀██▀▀██▀▀▀ $f6▀▀█▀▀█▀▀$rst
  694. $bld$f1 ▄▀ ▀▄ $f2▄▄▀▀ ▀▀ ▀▀▄▄ $f3▄▀▄▀▀▄▀▄ $f4 ▄▀ ▀▄ $f5▄▄▀▀ ▀▀ ▀▀▄▄ $f6▄▀▄▀▀▄▀▄$rst
  695. $f7▌$rst
  696. $f7▌$rst
  697. $f7 ▄█▄ $rst
  698. $f7▄█████████▄$rst
  699. $f7▀▀▀▀▀▀▀▀▀▀▀$rst
  700. EOF
  701. }
  702. #/etc/lsb-release