The cat sum. TXT | echo $[$(tr '\ n' '+') 0] will prompt illegal variable name! I write this. Execution is no problem in sh
For this is why
CodePudding user response:
This is not simple, I don't knowYou are can use the bash, even under the command line can output 15,
But you can't use the ZSH, but my mistake is the input/output error,
In sh, you if statement #!/bin/ZSH, there will be two cases
1.
./file. Shafter the operation, the command line waiting for input
2.
../file shafter the operation, at the same wrong
If you use ZSH and at the command line to run successful, use {}
cat sum. TXT | {echo $[$(tr '\ n' '+') 0]; }
CodePudding user response:
Direct copy, no errorCodePudding user response: