Bug 111386 - batch/at does not work for not-Bourne-like shells (e.g. tcsh)
batch/at does not work for not-Bourne-like shells (e.g. tcsh)
Status: CLOSED DUPLICATE of bug 109587
Product: Fedora
Classification: Fedora
Component: at (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jens Petersen
Mike McLean
Depends On:
  Show dependency treegraph
Reported: 2003-12-02 16:49 EST by Michal Szymanski
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-02-21 14:00:15 EST
Type: ---
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 Michal Szymanski 2003-12-02 16:49:15 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20030925

Description of problem:
According to man page, at/batch tries to execute commands entered
by user's environment variable SHELL, if set. For users using
e.g. tcsh this variable is set to "/bin/tcsh". Unfortunately,
the first part of the script generated by at/batch (which regenerates
the environment as seen at the time it was created) is in sh/bash
syntax, so it fails immediately when fed into "tcsh".

It seems to be indeed executed by "tcsh" (that differs from older
at versions seen in RH7.x, where it was always executed using
"(ba)sh") - it can be proven by entering Bourne-shell syntax commands
- this also fails.

Another problem arises from (strange) behavior of "bash" shell. When I
ran "bash" from my tcsh-prompt (to enter my at/batch commands in bash
syntax), it ... also failed because "bash" did not set SHELL variable,
so it remained "/bin/tcsh". Very weird.

The fix should be rather simple - I've seen a very simple solution to
the above shell-related problems in the implementation if at/batch in
Solaris. The script is *always* executed by /bin/sh, it starts with
sh-syntax set of environment rebuilding commands and then the user's
input is introduced by:

$SHELL << '...the rest of this file is shell input'
# user commands

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.batch                  # in a "tcsh" shell environment
2.foreach n ( 1 2 3 )
3.echo $n

Actual Results:  one gets e-mail complaining about dozens of
commands not found.

Expected Results:  e-mail containing:

Additional info:
Comment 1 Jens Petersen 2003-12-09 03:33:25 EST
Thanks, I think this is a good solution.

Modifying SHELL patch to this effect in at-3.1.8-49.

*** This bug has been marked as a duplicate of 91233 ***
Comment 2 Jens Petersen 2004-01-12 22:37:04 EST

*** This bug has been marked as a duplicate of 109587 ***
Comment 3 Red Hat Bugzilla 2006-02-21 14:00:15 EST
Changed to 'CLOSED' state since 'RESOLVED' has been deprecated.

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