-
Notifications
You must be signed in to change notification settings - Fork 1.8k
SC2325
Vidar Holen edited this page Jul 31, 2023
·
1 revision
#!/bin/sh
! ! true
#!/bin/sh
true
POSIX (and Dash) does not allow multiple !
pipeline negations in a row. It's also logically unnecessary.
Use either zero or one !
.
Scripts whose shebang declares it will run with Ksh and Bash will not trigger this warning.
If you really want to negate multiple times on POSIX or Dash, e.g. to normalize exit codes to 0 or 1, use cmd || false
or a command group:
! { ! true; }
- Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!