Bug 1030100

Summary: at doesn't seem to honor $SHELL
Product: [Fedora] Fedora Reporter: John Schmitt <marmalodak>
Component: atAssignee: Marcela Mašláňová <mmaslano>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: marmalodak, mmaslano
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: at-3.1.13-13.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-12-11 13:42:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Schmitt 2013-11-13 22:40:29 UTC
Do I understand correctly that the job should be run by bash rather than plan sh?

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

$ echo $SHELL
/bin/bash

Comment 1 Marcela Mašláňová 2013-12-02 11:09:26 UTC
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 17:29:23 UTC
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 14:38:09 UTC
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 23:22:50 UTC
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 13:42:47 UTC
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.