雑記
朝起きて、窓を開けるの。そしたら部屋が寒いの。
CLIでコピーをしたい
CLIでSTDINからの入力や、一つ前のコマンドをコピーしたいことがあるのでShell関数を定義している
# copy text to clipboard # usage: # - yy [text] -> copy [text] to clipboard # - [command] | yy -> copy [command]'s output to clipboard # - yy -> copy last command function yy() { local text="${*}" [ -p /dev/fd/0 ] && text=$(cat -) [ "$text" = "" ] && text="$(history | tail -n1 |cut -d' ' -f4-)" # wsl type clip.exe 2>&1 > /dev/null && echo -n "$text" | clip.exe && return 0 # xclip type xclip 2>&1 > /dev/null && echo -n "$text" | xclip -selection c && return 0 # xsel type xsel 2>&1 > /dev/null && echo -n "$text" | xsel -b && return 0 # pbcopy type pbcopy 2>&1 > /dev/null && echo -n "$text" | pbcopy && return 0 logger.warn "clip.exe, xclip, pbcopy or xsel not found" }
clip.exeかxsel,xclip,pbcopyがあれば使える。文章の最後の改行をトリムすべきかどうかは考え中。
fujitastulize
function fujitatsulize() { cat | sed 's/./&゛/g' } $ echo どうしてなんだよおおおおおおお|fujitatsulize ど゛う゛し゛て゛な゛ん゛だ゛よ゛お゛お゛お゛お゛お゛お゛お゛
おわり
今週も終わる