Last active
December 23, 2015 16:49
-
-
Save yurakawa/a44855321c1a6663f2be to your computer and use it in GitHub Desktop.
シェルスクリプトのTipsをメモ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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