SUMMARY (Preliminary): at jobs from bash

From: Ray Schnitzler (ras@unipress.com)
Date: Tue Oct 20 1992 - 20:19:38 CDT


I've received a number of replies, most of which don't work, perhaps because I
was not clear enough in the problem statment.

Most of the suggestions were various methods of making sure that my shell of
choice executed my script. This is not the problem; it does that just fine.
The problem is that a typical atjob file looks like this:
----------------------------
# at job
# owner: root
# jobname: stdin
# shell: sh
# notify by mail: no

llargs='-blgs'
export llargs
cpu='dot'
export cpu
CDPATH='.:/bang/u4/ras:/bang/u4/ras/src'
export CDPATH
term='xterm'
export term
DISPLAY='equal:0'
export DISPLAY
....<more var defs>
lln='() { \ ls -bCF $llargs -t $* | head\}'
export lln
....<more function defs>
$SHELL << '...the rest of this file is shell input'
#
# @(#).proto 1.3 88/02/08 SMI; from S5R3 1.1
#
cd mydir
my_shell_commands

-----------------------------------------

The last piece, "my_shell_commands" is executed correctly by $SHELL (and this
does the right thing if I use -s or -c), but ALL OF THE PRECEEDING STUFF is
executed by /bin/sh REGARDLESS of my shell.

Further research suggests that the problem is that bash thinks of functions as
sort-of, almost variables (whereas ksh and sh do not). That is, if I say
"set" to bash, I see functions and variables (unlike ksh, sh, or csh).

The part of "at" that constructs this preamble of envariable settings
therefore contains variable settings for functions, which of course don't
work when executed by sh in the preamble.

What limited experimentation that I can do with ksh suggests that functions
are not available in atjobs; there are no functions represented in the
preamble at all, in any form. (Under bash, they pretend to be available,
though they clearly don't work.)

Unless someone knows of an "at" that filters out these bogosities or rewrites
functions into legal function-definition syntax, it seems that I am out of
luck.

I think that I will write such a beast.

Thanks for your help.

Ray Schnitzler
UniPress Software

adam%bwnmr4@harvard.harvard.edu (Adam Shostack)
Dieter Muller <dworkin@shiara.rootgroup.com>
John A. Murphy <jam@philabs.philips.com>
blymn@awadi.com.au (Brett Lymn)
mau@beatles.cselt.stet.it
sproule@princeton.edu
Torsten Metzner <tom@plato.uni-paderborn.de>
tgsmith@spdev.east.sun.com (Timothy G. Smith - Special Projects)
stpeters@dawn.crd.ge.com (Dick St.Peters)



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:52 CDT