Today I tried this and was somewhat surprised to find that it didn’t work:
$ nice -n 10 { ./configure && make ; }
-bash: syntax error near unexpected token `}'
Is there a way to use grouping in a “subcommand”?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t just pass shell syntax to the argv of a program and expect it to understand it. Specifically, the error you’re seeing is because of the
&∧, which are “list operators” which separate commands. Bash is trying to evaluate the arguments toniceas:Bash then tries to evaluate the next command after the
&&(make), then the next command, which is}. Technically, braces are both “reserved words” and “control operators”. Different shells treat bare braces a bit differently but that’s an esoteric detail. The point is depending on the shell that will either be a parsing error (like here), or an error due to not being able to find a command named “}” (usually the former.Exceptions to this rule exist only within the shell itself. For instance, the Bash
coprockeyword works like this, enabling special parsing and evaluation of its arguments almost exactly as in your example.