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.
 
 
 
 
 
 

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