Bug 1030100 - at doesn't seem to honor $SHELL
at doesn't seem to honor $SHELL
Product: Fedora
Classification: Fedora
Component: at (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Marcela Mašláňová
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2013-11-13 17:40 EST by John Schmitt
Modified: 2013-12-11 08:42 EST (History)
2 users (show)

See Also:
Fixed In Version: at-3.1.13-13.fc19
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-12-11 08:42:47 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description John Schmitt 2013-11-13 17:40:29 EST
Do I understand correctly that the job should be run by bash rather than plan sh?

$ at -c 2134
SHELL=/bin/bash; export SHELL
${SHELL:-/bin/sh} << 'marcinDELIMITER2c849ce9'

$ echo $SHELL
Comment 1 Marcela Mašláňová 2013-12-02 06:09:26 EST
I'm sorry for such late response. The job should be executed by your preferred shell. It should work also for people who has as default csh. 
If you have bash as the default shell, then it's working properly.
Comment 2 John Schmitt 2013-12-02 12:29:23 EST
My $SHELL is /bin/bash, however, you can see at the top of this script that it invokes /bin/sh.  Am I missing something?
Comment 3 Marcela Mašláňová 2013-12-04 09:38:09 EST
If you read whole at job, you will see there is a line:
SHELL=your_shell; export SHELL
This shell is used for execution of the job. The /bin/sh is used only by at, not by your job.

Do you have a reproducer, where it didn't work? I tested it with csh and it worked fine.
Comment 4 John Schmitt 2013-12-05 18:22:50 EST
I tried to reproduce and I think I proved myself wrong:

echo 'DATE_CMD="date +%Y-%m-%d-%H-%M-%S-%N"; echo `$(DATE_CMD)` > /tmp/at.`$(DATE_CMD)`.out; ps -c -h -p $$ >> /tmp/at.`$(DATE_CMD)`.out' | at -m 1518

I still don't understand why DATE_CMD is not evaluated the way I expect.  This style of evaluation works under cron.  I wish $() would do nested evaluation.

Thanks for taking the time.
Comment 5 Marcela Mašláňová 2013-12-11 08:42:47 EST
I guess at has bash script inside of bash script, so you probably have to add more apostrophes somewhere. Anyway not a bug for me.

Note You need to log in before you can comment on or make changes to this bug.