Skip to content

Files

Latest commit

 

History

History
27 lines (17 loc) · 709 Bytes

SC2065.md

File metadata and controls

27 lines (17 loc) · 709 Bytes

Pattern: Possible misuse of shell file redirection

Issue: -

Description

A word that looks like a redirection in simple shell commands causes it to be interpreted as a redirection.

Example of incorrect code:

[ 1 >2 ] || [ 3>'aaa bb' ] # Simple example of problematic code

Example of correct code:

[ 1 -gt 2 ] || [ 3 \> 'aaa bb' ] # arithmetical, lexicographical

Exceptions

When it's among a continuous list of redirections at the end of a simple test command, it's more likely that the user really meant to do a redirection. Or any other case that you mean to do that.

Further Reading