crontabのスペースは重要ですか?

crontabのスペースは重要ですか?

crontabのマンページでは明確ではありません。フィールド間に余分なスペースを入れることはできますか?たとえば、次のような場合:

1 7 * * * /scripts/foo
5 17 * * 6 /script/bar
31 6 * * 0 /scripts/bofh

次のように再フォーマットしても安全ですか?

 1  7 * * * /scripts/foo
 5 17 * * 6 /script/bar
31  6 * * 0 /scripts/bofh

ベストアンサー1

はい、追加のスペースが許可され、読みやすくするためにフィールドを見やすく配置できます。 ~からman 5 crontab

Blank lines and leading spaces and  tabs  are  ignored.

そして

An environment setting is of the form,

   name = value

where the spaces around the equal-sign (=) are optional, and any  sub‐
sequent non-leading spaces in value will be part of the value assigned
to name.

フィールド自体について、マニュアルページには次のように表示されます。

The fields may be separated  by  spaces or tabs.

これは明らかでなければなりません。複数のスペースが許可されます。

おすすめ記事