hi,
i am trying to redirect output of at command to a file.
`at -k -f "menu.sh" now + 2 minutes` > at_out
but when at_out is empty file. why? how can i do this.
actually i want to get job id and want to store it in file.
hi,
i am trying to redirect output of at command to a file.
`at -k -f "menu.sh" now + 2 minutes` > at_out
but when at_out is empty file. why? how can i do this.
actually i want to get job id and want to store it in file.
The backticks expand to the output of the at command -- for a start, take those out.
Do you want to capture the output of the command you run, or the output from at (job number etc)? If the former, do something like
at -k now + 2 minutes <<HERE
menu.sh >at.out
HERE
If the latter, simply remove the backticks from your original command, and maybe add 2>&1 to the end; at least on Linux, the output from at is to standard error, not standard output.
i want output of at command, that is job id return by at command.
i tried to do same thing
like
at -k -f "menu.sh" now + 2 minutes 1>at_out
but still at_out file is empty. i used backticks because i am using script to do this thing.
As hinted earlier, try 2>at_out if that didn't work.
In general, a command works the same in a script and on the command line; if you would not use backticks on the command line, don't use them in a script either.
hey thank it worked.
now i have can get jod id from that file.