Skip to content

Instantly share code, notes, and snippets.

@tsuyoshicho
Last active January 9, 2017 02:32
Show Gist options
  • Save tsuyoshicho/9ceb84dab180cb862b89 to your computer and use it in GitHub Desktop.
Save tsuyoshicho/9ceb84dab180cb862b89 to your computer and use it in GitHub Desktop.
シェルスクリプトでのLTSV出力イディオム ref: http://qiita.com/tsuyoshi_cho/items/4371c94e4e86b8406053
#!/bin/bash
cat << EOS | tr '\n' '\t' | sed -e 's/\t*$//' >> ${log}
name:${app}
time:$(date --iso-8601=seconds)
pid:$$
args:"${*}"
EOS
echo "" >> ${log}
# このスクリプトで、ログには自分自身(の名前/)PIDを出しているが
# 実行した(コマンド名/)ステータス/PIDとするなら以下のような行を入れる
# 直前に実行したコマンド(同期実行)のステータス(ex test -f <file>)
status:$?
# 直前に実行したコマンド(非同期実行)のPID(ex.make &)
pid:$!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment