How the command "at" works?

Peng Yu pengyu.ut at gmail.com
Sat Aug 6 16:44:38 UTC 2016


On Sat, Aug 6, 2016 at 10:38 AM, Karl Auer <kauer at biplane.com.au> wrote:
> On Sat, 2016-08-06 at 10:26 -0500, Peng Yu wrote:
>> > And if it is, do you need your atjobs to have ad hoc access to
>> > any functions that happen to be defined by any user that happens to
>> > create them, or do you need your atjobs to have access to a
>> > particular set of functions?
>> >
>> Sorry. I mean the former not the latter.
>
> That's fairly easy then. All you need to do is add a fixed "source
> /path/to file" line to the output generated by at, pointing to a file
> that you pre-populate with the functions (or anything else!) that you
> need. And of course make the same mods I did so that bash is used as
> the shell rather than sh.

But I don't want the user to be burden by having to source a file. I
just want a piece of code like the following work as it using my new
at (myat) so that the users don't need to be aware how the environment
is maintained.

function my_fun() {
echo "f: $(date)"
}

tmpfile=$(mktemp)
myat -t "$(date +%Y%m%d%H%M.%S --date="$time")" <<EOF
date > $tmpfile
my_fun
EOF

-- 
Regards,
Peng




More information about the ubuntu-users mailing list