In bash, brace expansion is performed as a shell operation before executing the command.1 This means the following will work:echo {1..10} >output | at -m now
The output will be 1 2 3 4 5 6 7 8 9 10.
What does not work is an attempt to perform brace expansion within the at command which warns that commands will be executed by /bin/sh, which in my case is linked to dash which does not seem to support range expansion using braces.
$ at - now
warning: commands will be executed using /bin/sh
at> echo {1..10} >output
at> <EOT>
This will run the command in dash (or Bourne or whatever shell you have /bin/sh linked to) resulting in the output {1..10}.
How can brace expansion be performed when using the at command this way?
I am interested in seeing other solutions to this besides the one I've posted as an answer, such as being able to execute commands with bash from within the at prompt. It seems like more effort than necessary to create a script for every single line command that is run from the at prompt.
Aucun commentaire:
Enregistrer un commentaire