On Thu, Jan 21, 2021 at 10:27:54PM +0100, Mathias Steiger wrote: > Suppose I wrote a simple script: > > {if echo "27ac5e2f757302" >& /dev/null; then echo "yes"; else echo "no"; > fi } > output
I count at least 3 bugs here, or 4 if you run this from something that works around the exec format error by running sh rather than bash. If this is supposed to be an actual script, then you need a shebang. That's number one. If you're going to use curly braces to turn the compound "if" command into a command group, then you need a space after the first brace (that's two), and you need a newline or semicolon or other command terminator before the second brace (that's three). Of course, you could fix both of those by simply removing the curly braces entirely. Finally, if you're writing this as an sh script, you cannot use the >& operator for redirection. That's a bashism. That's number four, if the missing shebang is #!/bin/sh. If the missing shebang invokes bash, then the >& operator is permitted, but I still wouldn't advise it. When reporting a bug and showing an example script, it's best if the example script actually *runs*, and ideally, produces the actual results that you are reporting as a bug. Just typing random malformed commands into an email as an "example" does not help anyone.