7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

標準出力を受けて保存するファイル名に日付や時刻を含める

Last updated at Posted at 2014-05-23

dateコマンドの+以降に出力フォーマットを指定します。
このdateコマンドをバッククオート``内に入れれば、dateコマンドの実行結果が引き継がれます。
##result月日時分.txt
例えばtest.rbの実行結果をresult月日時分.txt(月日時分は各2桁)という形式のファイル名で保存する場合には

$ ruby test.rb > result`date +%m%d%H%M`.txt

とします。
##参考

7
6
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
7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?