LoginSignup
1
2

More than 5 years have passed since last update.

bash のデバッグメモ

Posted at

bash の実行ログを取りたい時に

#!/bin/bash

LOG_FILE=debug.log

# 標準出力をファイルに出力
exec > $LOG_FILE

# 標準エラー出力も同じファイルに出力
exec 2>&1

# エラーで止める
set -eu

# デバッグを開始する
set -x
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2