我正在寻找一个简单但跨平台的否定过程来否定过程返回的价值.它应该将0映射到某个值!= 0和任何值!= 0到0,即以下命令应返回"yes,nonexistingpath不存在":
ls nonexistingpath | negate && echo "yes, nonexistingpath doesn't exist."
的! - 运算符很棒但很遗憾不是shell独立的.
shell cross-platform negate
cross-platform ×1
negate ×1
shell ×1