Skip to content

Instantly share code, notes, and snippets.

@yurakawa
Last active December 23, 2015 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yurakawa/a44855321c1a6663f2be to your computer and use it in GitHub Desktop.
Save yurakawa/a44855321c1a6663f2be to your computer and use it in GitHub Desktop.
シェルスクリプトのTipsをメモ
#!/bin/bash
# シェルスクリプトで一時的なファイル(中間ファイル)を作成
tmp=/tmp/$$
echo hoge > $tmp-hoge
rm $tmp-*
# あるファイルがなければシェルスクリプトを終了する
[ -f "/etc/passwd" ] || exit 1
# サンプル数列作成
seq 1 20 | xargs -n 5 > data
cat data
# 1 2 3 4 5
# 6 7 8 9 10
# 11 12 13 14 15
# 16 17 18 19 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment