Using "here documents" in batch jobs not working
I'm thinking about using batch(1) for some simple but numerous things I want to do on my hobby project. A few hundred thousand of them before I'm done. The most obvious way to do this for me involves putting data in a "here document". This is not working for me, either in at(1) jobs or batch(1) jobs.
Example: kevin:~$ at noon warning: commands will be executed using /bin/sh at> echo <<EOF >noon.output at> foo at> bar at> EOF at> <EOT job 9 at Sat Jan 2 12:00:00 2016 Using "at -c 9" I can see that the job consists of a bunch of environment setup scripting followed by just what I would expect: cd /home/kevin || { echo 'Execution directory inaccessible' >&2 exit 1 } echo <<EOF >noon.output foo bar EOF But when the job executes, what I get in noon.output is a single blank line (a file containing only a newline). Now I know how to work around this by creating temporary files containing the data, but that's a complication I'd rather avoid. Besides, I just want to know why this isn't working. It's not a problem with /bin/sh that I know of, since that shell does here documents just fine. Any ideas? Is there a better place to ask this? |
You should use cat instead of echo, because echo doesn't read stdin (here-documents send their data to stdin).
|
All times are GMT -5. The time now is 03:34 AM. |