I have two scripts say one.sh and two.sh.
I want one.sh to continuously export a variable in loop. and when two.sh starts then it should read the last value exported from one.sh.
file: one.sh
file two.sh
I am running 1st script in background as sh one.sh &
and starting two.sh .Then two.sh is not printing the vale of VAR exported from one.sh.
your shell might not support your export in one step : do it it two steps (or switch to ksh) :
Maybe i am wrong, but i think, the variable is stored in a process/user context. So you must have processes dependencies to be able to inherit the access to environment variable, if your 2 processes are launched independantly from eachother they exectue in their own context and won't** be able to share the variable.
Maybe you should try to call the second shell from the first one so it can inherit from the parent process environment.
(**) unless they are designed storing their env in a shared memory part to which anybody have an access which might be a security weakness.
Quote:
Originally Posted by bhushan123
Hi,
I have two scripts say one.sh and two.sh.
I want one.sh to continuously export a variable in loop. and when two.sh starts then it should read the last value exported from one.sh.
file: one.sh
file two.sh
I am running 1st script in background as sh one.sh &
and starting two.sh .Then two.sh is not printing the vale of VAR exported from one.sh.
Hi all
I am trying to create a script that takes a password input then writes that to a tmp file and puts that tmp file path in my env as a var.
It does everything but export the my env and I am unsure why.
I am using Ubuntu 12.4
#!/bin/bash
read -s -p "Enter Password: " gfpassword... (5 Replies)
Hi,
Problem Statement: We have 400 shell scripts to be tested and they run over 4-5 different unix environments. All these are run in SUDO mode.
My requirement is to Define aliases for each script which accepts the Date & Order ID as a parameter so that I can submit all these scripts from 1... (4 Replies)
Hello,
I've inherited an NFS setup that allows external servers to write to an NFS share on a Centos box. Here is an example line from /etc/exports (there are four entries that only are different based on server IP adress).
/exports/foobar... (4 Replies)
(Above from Apache docs).
On my system, using:
SetEnvIf User-Agent Mozilla IsBad=1
Order allow,deny
Allow from all
Deny from env=IsBad ...I see that environment variable is set (using phpinfo()) but the page is still served. No errors in the Apache logs. (1 Reply)
Hi
I'm trying to understand variable scopes in solaris10.
It is said that to display env variables we use 3 commands :
- env
- set
- export
What is the difference between them ?
thx for help.
---------- Post updated at 11:00 AM ---------- Previous update was at 10:50 AM ----------
... (2 Replies)
Hi
I need one help for connecting oracle from unix. I have query.ctl file where i have wriiten my oracle query.How can i execute this sql throgh unix
thnxx all (1 Reply)
I have a shell script I want to run that will set environment variables based on the value of an input variable submitted when the shell script is called. For example:
$ mgenv.sh prod
This would set environment variables for prod
$ mgenv.sh test
This would set environment variables... (1 Reply)
Hi !
How to export ENV variables, which remains set for all the shell
Example :-
Login :myID
Pwd : **** -> Here my ID .profile is executed. Let say I set MYENV variable
Kisses% rlogin ABC -l XXXGroupID -> I login into a remote Solaris Server ABC
password : **** -> "XXXGroupID's... (1 Reply)
hi i want to write a shell script to set environment variables . But i am not been able to set that for the current shell instead i have to spawn a new shell. Is there a way to set the env variable for the current shell using shell script in bash shell ?
Thnx (2 Replies)
Hi all,
I have seen it in all the .profile files and env file this
PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:.
export PATH
What exactly does this Export path does??
Thanks
SUmeet (1 Reply)