Bash question

Rick Sivernell res005ru
Mon May 17 11:43:14 PDT 2004


On Fri, 17 Jan 2003 13:44:08 -0500
"David A. Bandel" <david at pananix.com> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Thu, 16 Jan 2003 23:26:13 -0600
> begin  Rick Sivernell <res005ru at gte.net> spewed forth:
> 
> > Lonnie David kurt or other bash guru
> > 
> > I have a short little script as below:
> > export DEBUG=$1
> > 
> > export PRJ_LIB_PATHS="-L/usr/X11R6/lib -L$XCLASS_LIB -L$STLPORT_LIB"
> > case $DEBUG in
> >   '' ) lLIBS="-lxclass -lXpm:-lX11 -lXft -lXaw3d:-lXrender -lXfont
> > -lstlport_gcc"  echo Non Debug
> > 			;;
> > 	
> > 	1 ) lLIBS="-lxclass -lXpm -lX11 -lXft -lXaw3d -lXrender -lXfont
> > -lstlport_gccDebug"	echo Debug
> > 	 ;;
> > 	esac
> > 
> > export lLIBS	
> > PRJ_LIBS=$lLIBS
> > export PRJ_LIBS	
> > 
> > echo $PRJ_LIBS_PATHS
> > echo $PRJ_LIBS
> > 
> > now when I run it, I get the following: 
> > [root at RickSivernell silverware]# ./EnvVar 
> > Non Debug
> > 
> > -lxclass -lXpm:-lX11 -lXft -lXaw3d:-lXrender -lXfont -lstlport_gcc
> > [root at RickSivernell silverware]# echo $PRJ_LIB_PATHS
> > 
> > [root at RickSivernell silverware]# echo $PRJ_LIB      
> > 
> > [root at RickSivernell silverware]# sh EnvVar 1
> > Debug
> > 
> > -lxclass -lXpm -lX11 -lXft -lXaw3d -lXrender -lXfont
> > -lstlport_gccDebug[root at RickSivernell silverware]# echo $PRJ_LIB
> > 
> > [root at RickSivernell silverware]# echo $PRJ_LIB_PATHS
> > 
> > [root at RickSivernell silverware]# 
> > 
> > The script is as below:
> > -rwxrwxr-x    1 rick     users         403 Jan 16 23:18 EnvVar
> > 
> > I am trying to set terminal window Enviroment variable by script. I
> > assume I have missed something in the book or doing something wrong.
> 
> When you run the program as you did: ./programname
> 
> you are spawning a child process.  Any environment variable set in a
> child process can be inherited by its children, but not by its parent.
> 
> what you need to do is:
> 
> . ./programname
> or:
> source ./programname
> 
> this sources the program and does not spawn a child but runs it in the
> current process, so environment variables are set in the current
> process and not in the child (to be lost when the child exits).
> 
> You follow?
> 
> Ciao,
> 
> David A. Bandel
> - -- 
> Focus on the dream, not the competition.
> 		-- Nemesis Racing Team motto
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.1 (GNU/Linux)
> 
> iD8DBQE+KE743uVcotqGMQcRAjJBAKCdLt2atO6atxHHSuG5KSNkpYXrSQCg191A
> P3IbVe1r35tIIjLH4L0oeSM=
> =wIvW
> -----END PGP SIGNATURE-----
> _______________________________________________
> Linux-users mailing list
> Linux-users at linux-sxs.org
> Unsubscribe/Suspend/Etc ->
> http://www.linux-sxs.org/mailman/listinfo/linux-users

David

   Absolutely, & it is what I needed. Kew that from class several years
ago, But today I have an alltimers moment<g>

Many thanks

-- 
Rick Sivernell
Dallas, Texas  75287
972 306-2296
res005ru at gte.net
Caldera Open Linux eWorkStation 3.1.1
Registered Linux User

   .~.
  / v \
 /( _ )\
   ^ ^
In Linux we trust!


More information about the Linux-users mailing list