Skip to main content
added link
Source Link
Kamil Maciorowski
  • 24.5k
  • 2
  • 69
  • 129

> 0 redirects to a file named 0. Note > something or similar syntax does not have to be at the end. The file will be created even if the former part ofcommand being redirected doesn't make sense. In your case the redirectioncommand is (i.e.[ 1 ] and it's syntactically valid: it checks if 1 in your case) doesn't make senseis a non-empty string.

You probably meant [ 1 -gt 0 ]. See help [ and help test | less.

> redirects to a file. The file will be created even if the former part of the redirection (i.e. 1 in your case) doesn't make sense.

You probably meant [ 1 -gt 0 ]. See help [ and help test | less.

> 0 redirects to a file named 0. Note > something or similar syntax does not have to be at the end. The file will be created even if the command being redirected doesn't make sense. In your case the command is [ 1 ] and it's syntactically valid: it checks if 1 is a non-empty string.

You probably meant [ 1 -gt 0 ]. See help [ and help test | less.

Source Link
Kamil Maciorowski
  • 24.5k
  • 2
  • 69
  • 129

> redirects to a file. The file will be created even if the former part of the redirection (i.e. 1 in your case) doesn't make sense.

You probably meant [ 1 -gt 0 ]. See help [ and help test | less.