On Thu, 2008-11-20 at 11:07 -0800, Jeremiah wrote:
> Working on a probably fairly common task -> getting a jbc (jbasic)
> program to run from a cron entry in Linux. This jbc program may call
> several other (jbc) programs via the EXECUTE command.
>
> Something that I'm noticing in the way I use PUTENV() is that PUTENV()
> does not appear to recognize dollar signs? For example,
PUTENV does not call a shell and it is the shell that does the $
substitution.
>
> 001 IF PUTENV("PATH=$JBCRELEASEDIR/bin:/data/development/bin:
GETENV("PATH", PATH)
GETEND("JBCRELEASEDIR", JBCRELEASEDIR)
IF PUTENV("PATH=":JBCRELEASEDIR:"/bin:/data/development/bin:":PATH) THEN
> $PATH") TH
> 002 IF GETENV("PATH", PATHOUT) THEN
> 003 CRT SQUOTE(PATHOUT)
> 004 END
> 005 END
>
> Yields me: '$JBCRELEASEDIR/bin:/data/development/bin:$PATH'
>
> Is it something incorrect with my PUTENV() syntax?
No - the syntax is correct :-)
>
> The reason I was using PUTENV() is so I can control environmental
> variables from within each jbc program. Is it true that EXECUTE will
> spawn a new shell session for each call?
EXECUTE does not spawn a shell unless you tell it to:
EXECUTE CHAR(255):"k":"Command to run in korn shell"
> I'm trying to come up with
> the best way to share these environmental variables across all called
> programs.
You might be better running the cron job via a shell script that
configures the environment. This script, and any other, can source from
a common area:
#! /bin/bash
# Pick up standard environment
#
. /data/envs/develenv.bash
Consult the documentation on the jBASE knowledgebase on these functions.
Jim
--~--~---------~--~----~------------~-------~--~----~
Please read the posting guidelines at:
http://groups.google.com/group/jBASE/web/Posting%20Guidelines
IMPORTANT: Type T24: at the start of the subject line for questions specific to
Globus/T24
To post, send email to [email protected]
To unsubscribe, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en
-~----------~----~----~----~------~----~------~--~---