tags:

views:

769

answers:

3

Every time I use the "at" command, I get this message:

warning: commands will be executed using /bin/sh

What is it trying to warn me about? More importantly, how do I turn the warning off?

+7  A: 

It serves as a good warning to those of us that don't use bash as our shell, because we we'll forget that a feature that's in our day-to-day shell isn't going to be available when this code is run at the appointed time.

i.e.

username@hostname$ at 23:00     
warning: commands will be executed using /bin/sh
at> rm **/*.pyc
at> <EOT>
job 1 at 2008-10-08 23:00

The use of '**' there is perfectly valid zsh, but not /sbin/sh! It's easy to make these mistakes if you're used to using a different shell, and it's your responsibility to remember to do the right thing.

Jerub
/bin/sh is the Bourne shell, not Bash.
John Millikin
Heck, even /bin/bash and /bin/sh act differently, even when /bin/sh is symlinked to bash.
ephemient
@John well it's usually a symlink to bash... (not on Ubuntu however... so yea it matters)
Spudd86
A: 

If you wish to get around that message, have 'at' run a script that calls a specified environment, be it ksh, bash, csh, zsh, perl, etc.

addition - see the 'at' man page http://www.rt.com/man/at.1.html for more information.

at and batch read commands from standard input or a specified  file which are to be executed at a later time, using /bin/sh.
warren
No, I mean, how do I turn off *the warning message?*
raldi
+1  A: 

Does the warning have any harmful effect aside from being annoying? The man page doesn't mention any way of turning it off, so I don't think you can stop it from being emitted without rebuilding your at from source.

Now, if you want to just not see it, you can use at [time] 2>/dev/null to send it off to oblivion, but, unfortunately, the at> prompts are printed to STDERR for some reason (a bug, IMO - they really should go to STDOUT), so they're also hidden by this. It may be possible to work up some shell plumbing which will eliminate the warning without also eating the prompts, but a) my attempt at this (at [time] 2>&1 | grep -v warning) doesn't work and b) even if you can find a combination that works, it won't be suitable for aliasing (since the time goes in the middle rather than at the end), so you'll need to either type it in full each time you use it or else write a wrapper script around at to handle it.

So, unless it causes actual problems, I'd say you're probably best off just ignoring the warning like the rest of us.

Dave Sherohman