oneliner

スペース区切りのリストをxargsに渡す方法が徐々に短くなっていく様子

#1 echo 'a.hatena.ne.jp d.hatena.ne.jp f.hatena.ne.jp' | tr ' ' '\n' | xargs -I%% host %% #2 echo {a,d,f}.hatena.ne.jp | tr ' ' '\n' | xargs -I%% host %% #3 echo -e {a,d,f}.hatena.ne.jp"\n" | xargs -I%% host %% サンプルで使うドメインのセレ…

Bashパラメータ展開+xargs でいい感じにリネーム

ls -1 aaa.example.jp.txt bbb.example.jp.txt ccc.example.jp.txt ddd.example.jp.txt eee.example.jp.txt ls -1 | xargs -I{} bash -c 'f={}; mv ${f} ${f/.jp/.jp.201307}' ls -1 aaa.example.jp.201307.txt bbb.example.jp.201307.txt ccc.example.jp.20…

ssh接続が成功するまでリトライする

while ! ssh -o ConnectTimeout=1 user@server; do sleep 1; done