EXPORT allows shell variables to be passed onto sub processes of the current shell not back up to the calling process.
If you want a child script to set environment variables in the parent (calling) script source the child script. Example:
See how the second instance sc_1 is sourced into the current shell by using . ./sc_1 (or source ./sc_1 if you prefer the clearer long-hand form). Any variables set will now be in the current shell. Think of this as reading the commands in the child script into the current process not spawning a new shell to run sc_1 which loses any environment vars after it finishes.
This User Gave Thanks to Chubler_XL For This Post:
First: me == noob. Whats a good resource for shell script info cause I'm having trouble finding good info.
I'm writing a shell script to automate the setup of a flash 'page flip'.
My current code is below.
the page flip takes an xml file of format
<content>
<pages... (1 Reply)
Hi all!
I know that environment variables can be set on the .bashrc file, but I need to set them from a sh script. I saw a lot of websites that teach this but it doesn't work for me.
#!/bin/sh
DEKTOP=$DESKTOP=:/home/rrodrigues/Desktop
export DESKTOP
if I do echo $DESKTOP returns me... (10 Replies)
oopps! I Meant "Define Variables within a UNIX Script"
What would be the best way to define a variable in a unix shell script so anyone who views this script doesn't know what value is assigned to that variable.
some other location...
a="/usr/lib/fileA"
Unix script...
sed... (5 Replies)
Hello Everyone
I need to create a script file which must append some lines to a target text file, I'm using sed for windows, the script file look like this:
{
a\
STRINGTABLE DISCARDABLE\
BEGIN\
5, 150 {a\
#define RC_SHELL, "%ID_SHELL%"\
#define RC_NAME, "%ID_NAME%"\
END
}
... (1 Reply)
Hi All,
I am using ETL tool Datastage and is installed on Linux environment. Few environment variables are set in datastage. Now my requirement is to use those environment variables in a unix script.
Is there any option I can do it?
Sugeestions from people working on datastage and linux... (1 Reply)
I'm pretty new to scripting in Korn shell so please forgive me...
What I'm trying to do is to create a script that calls multiple other ksh scripts and defines variables for text files.
I need it to define my user defined variables (file paths, date & time stamps, etc that are currently in... (1 Reply)
I have tried with the following:
csh -c 'source ~/.cshrc; exec bash' # works perfectly
(cat ~/.cshrc; echo exec bash) | csh # not working
And, using sed, I successfully retrieved the environment variables from ~/.cshrc
sed -rn 's/setenv\s+(\S+)\s+(.*)$/export \1=\2/p' ~/.cshrc
but now... (6 Replies)
how to store the count of queries in variables inside a filein shell script
my output :
filename
-------
variable1=result from 1st query
variable2=result from 2nd query
.
.
.
. (3 Replies)
Dear Shell script Experts,
I am working on shell script which is defined here, qsub_seq.csh . The purpose of this script is to read few input files (with defined starting index and last index) and make processing faster over server.
For some task, I had 1064 of input files, so I wrote another... (8 Replies)
Discussion started by: emily
8 Replies
LEARN ABOUT DEBIAN
yexpand
YEXPAND(1) General Commands Manual YEXPAND(1)NAME
yexpand - tool to expand environment variables in Nypatchy cradles
SYNOPSIS
yexpand inputfile [ outputfile ]
DESCRIPTION
yexpand is a very simple script to expand environment variables in a text file to their current values in the shell environment. It was
written to be used with nypatchy cradles. It is recommended you not try to use it for any other purposes (note BUGS below).
USAGE
yexpand takes inputfile as input, replaces all instances of shell variables (in the form $VARIABLE or ${VARIABLE}) with their current val-
ues in the environment, and saves the result to outputfile. Undefined variables are replaced with the empty string. If outputfile is not
given, the result is instead saved to the current directory as a file of the same name as inputfile. Thus an input file in the current
directory will be overwritten.
BUGS
This script is very simple-minded. Since it basically just echos its input file as a here-doc, it will attempt to perform all types of
shell substitution (command substitution, etc.) as well as variable substitution. Hence it is likely to fail on anything except the very
simplest text files.
Additionally, this script creates a temporary file. The file is created in the current directory, so there should not be security implica-
tions. However, any existing file named file.yexp (where file is the basename of inputfile) in the current directory will be overwritten
and then deleted.
SEE ALSO fcasplit(1), nycheck(1), nydiff(1), nyindex(1), nylist(1), nymerge(1), nypatchy(1), nyshell(1), nysynopt(1), nytidy(1)
The reference manual for the Nypatchy suite of programs is available in compressed PostScript format at the following URL:
http://wwwasdoc.web.cern.ch/wwwasdoc/psdir/p5refman.ps.gz
AUTHOR
This manual page was written by Kevin McCarty <kmccarty@debian.org> for the Debian GNU/Linux system (but may be used by others). It is
licensed under the GNU General Public License, version 2 or later (at your choice).
COPYRIGHT
Copyright (C) Kevin B. McCarty, 2008.
Mar 12, 2008 YEXPAND(1)