problems with unix & command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting problems with unix & command
# 1  
Old 10-15-2012
problems with unix & command

My objective is to check the value of a variable which I will set it in the command line after sleep time mentioned in the script.I have executed my script in the background then pressed Enter.I have set temporary variable like below export PAUSE="PAUSE".I am not getting the value of the variable after SLEEP time mentioned in the script.Please help me.I have to print the value of the variable given in the command prompt once the script resumes after sleep time.

Example:scriptname &(script will sleep for 10 seconds)

Pressed Enter

export PAUSE="PAUSE"

when the script resumes I am not getting the value of the variable PAUSE.
# 2  
Old 10-15-2012
When a child process runs no variables are visible to the parent process. So if you create or change a variable in your background process you will not see it in the interactive (parent) process
# 3  
Old 10-15-2012
problem with & command in unix

How to accomplish this.Any help would be appreciated.
# 4  
Old 10-15-2012
You don't. Variables don't work that way.

You must talk in other ways. Perhaps print to stdout, and have the parent read from its output.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problems with ampersand (&) in sed command

Hello everybody, I have a Problem with sed command. I want to replace a defined string with a string from a database field (dynamic). e.g. sed -i -e 's/%NAME%/'"$HNAME"'/g' The Problem is that the $HNAME variable can contain Special characters like '&' e.g. HNAME="AH Kruger & Co. KG" ... (1 Reply)
Discussion started by: Bambuti2000
1 Replies

2. UNIX for Advanced & Expert Users

SCO 6.0 & VMware problems

I've moved a physical server over to VMWare ESXi 5.1 using SCO 6.0 with MP4. For whatever reason, people are occasionally getting kicked out or are closing out their telnet session and it is leaving their processes running. When this happens, the sar %idle drops from 98-95% down to 25-20%. ... (1 Reply)
Discussion started by: Carlitos71
1 Replies

3. UNIX for Dummies Questions & Answers

Problems using Unix mail command (2)

I recently generated myself the following error when attempting to use the Unix mail command: The flags you gave make no sense since you're not sending mail. There is a recent thread about this issue here in unix.com (with a title very much like this thread's title), but it was closed... (2 Replies)
Discussion started by: Clovis_Sangrail
2 Replies

4. Shell Programming and Scripting

echo & sed problems

I need a script to to instert the following line into my postfix master.cf file: flags=Rq user=filter argv=/etc/postfix/disclaimer -f ${sender} -- ${recipient}if I use echo I get the line truncated: :~ echo flags=Rq user=filter argv=/etc/postfix/disclaimer -f ${sender} -- ${recipient}... (3 Replies)
Discussion started by: barrydocks
3 Replies

5. UNIX for Dummies Questions & Answers

nohup & mpiexec problems

Hi everyone - I'm trying to start a run of LAMMPS (which takes an input file) with mpiexec on multiple processors. I want to combine this with nohup so that I can log off the node. I've used the syntax below successfully on one cluster, but it doesn't work on the new one I'm using. Any... (0 Replies)
Discussion started by: erin85
0 Replies

6. UNIX for Dummies Questions & Answers

Problems with find & -size

Hi I am trying to find files over a size given by the user. this is what I have so far echo "Enter a pathname to check (example = /home/jsk1gcc/testwork): " read input echo "Enter a the size (examples = 100k, 10M, 1G): " read size find $input -size +$size echo echo "Hit the Enter... (2 Replies)
Discussion started by: AngelFlesh
2 Replies

7. UNIX for Dummies Questions & Answers

Problem with xterm & tcsh & sourcing a script in a single command

Hi friends, I have a script that sets the env variable path based on different conditions. Now the new path variable setting should not done in the same terminal or same shell. Only a new terminal or new shell should have the new path env variable set. I am able to do this only as follows: >cd... (1 Reply)
Discussion started by: sowmya005
1 Replies

8. Shell Programming and Scripting

Net::SSH::Perl->Execute any unix command & display the output in a proper form

Net::SSH::Perl ...... how to print the output in a proper format my $cmd = "ls -l"; my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $pass); my($stdout, $stderr, $exit) = $ssh->cmd("$cmd"); print $stdout; the script works fine, but i am unable to see the output... (2 Replies)
Discussion started by: gsprasanna
2 Replies

9. UNIX for Advanced & Expert Users

UFSDUMP & UFSRESTORE problems

Hi, guys ! I need some expert help on following problem: When trying to restore content of a machine using another backup machine using Ufsdump/Ufsrestore, it worked on /local1, but when attemting to do the same on /local2,/local3 and /local4, I get permission problems. Running superuser does... (9 Replies)
Discussion started by: DGoubine
9 Replies
Login or Register to Ask a Question