Tux

...making Linux just a little more fun!

1-cent Tip: passing one line commands to at

Lew Pitcher [lew.pitcher at digitalfreehold.ca]


Mon, 21 Sep 2009 10:37:40 -0400

Hi guys,

On September 21, 2009 01:08:09 Mulyadi Santosa wrote: [snip]

> Don't worry, you don't need to use GUI automation tool such as dogtail
> for doing so. Simply use gnome-power-cmd.sh command to do that. Note:
> make sure atd daemon is running first. Then do:
> $ at now + 10 minutes
> at> gnome-power-cmd.sh suspend
> at> (press Ctrl-D)
[snip]

This post reminded me that at(1) reads it's commands from stdin. Not that I had forgotten that fact, but that I usually avoid it. I rarely need to enter multi-line commands into at-scripts, and avoid having to cope with at's stdin by using the echo command.

For instance, I would have written the above at(1) invocation as

  echo gnome-power-cmd.sh suspend | at now + 10 minutes

Trivial, I know. That's why I called it a "1 cent tip" :-)

-- 
Lew Pitcher
 
Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/   | GPG public key available by request
----------      Slackware - Because I know what I'm doing.          ------


Top    Back


Mulyadi Santosa [mulyadi.santosa at gmail.com]


Tue, 22 Sep 2009 03:58:44 +0700

On Mon, Sep 21, 2009 at 9:37 PM, Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote:

> Hi guys,
>
> On September 21, 2009 01:08:09 Mulyadi Santosa wrote:
> [snip]
>> Don't worry, you don't need to use GUI automation tool such as dogtail
>> for doing so. Simply use gnome-power-cmd.sh command to do that. Note:
>> make sure atd daemon is running first. Then do:
>> $ at now + 10 minutes
>> at> gnome-power-cmd.sh suspend
>> at> (press Ctrl-D)
> [snip]
>
> This post reminded me that at(1) reads it's commands from stdin. Not that I
> had forgotten that fact, but that I usually avoid it. I rarely need to enter
> multi-line commands into at-scripts, and avoid having to cope with at's stdin
> by using the echo command.
>
> For instance, I would have written the above at(1) invocation as
>  echo gnome-power-cmd.sh suspend | at now + 10 minutes
>
>
> Trivial, I know. That's why I called it a "1 cent tip" :-)

Thanks for the valuable addition :) OK, I'll stop here to make sure this tip won't be half a cent tip :D

-- 
regards,


Top    Back