4

I want to invert the exit code of a piped command sequence: foo | bar within the ZSH. So 0 maps to 1 and 1-128 maps to 0.

math
  • 2,633
  • 8
  • 31
  • 43

1 Answers1

7

POSIX shells, including bash, zsh and dash, support the ! modifier:

! foo | bar
u1686_grawity
  • 426,297
  • 64
  • 894
  • 966