LoginSignup
0
0

More than 5 years have passed since last update.

コマンドを実行しつつコマンド名をechoするbash関数

Posted at

コマンドを列挙するようなスクリプトファイルを書いているときに、どのコマンドを実行しているのか明示することができます。

function trace {
  # コマンドがわかりやすいように青の太文字
  echo -e "\033[1m$@\033[0m" >&2

  "$@"
}
使い方
$ trace ls -al
ls -al
drwxr-xr-x+ 138 hk    staff   4.3K  9  4 04:10 .
drwxr-xr-x    6 root  admin   192B  9 16  2017 ..
...
0
0
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
0
0