Skip to content

Files

Latest commit

 

History

History
26 lines (16 loc) · 650 Bytes

SC2177.md

File metadata and controls

26 lines (16 loc) · 650 Bytes

Pattern: Use of time with compound command

Issue: -

Description

time is only defined for Simple Commands by POSIX. Timing loops, command groups and similar is not.

Example of incorrect code:

time for i in *.bmp; do convert "$i" "$i.png"; done

Example of correct code:

time sh -c 'for i in *.bmp; do convert "$i" "$i.png"; done'

Exceptions

None. If you use a shell that supports this (e.g. bash, ksh), specify this shell in the shebang.

Further Reading