LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-10-2009, 06:27 PM   #1
manwithaplan
Member
 
Registered: Nov 2008
Location: ~/
Distribution: Arch || Sidux
Posts: 393

Rep: Reputation: 45
Variable passed from one script to the next


I have a script that sets up and creates a chroot environment. Then copies the secondary over into chroot & continues. Question is, does the previous variables declared in the first carry over? I do know that its a different environment being chrooted. Just curious... before I start re-writing my secondary script.
 
Old 03-11-2009, 11:06 AM   #2
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,596

Rep: Reputation: 80
yes it does.
test it:
Code:
export FOO=BAR
chroot / bash
echo $FOO
answer:
Code:
BAR
If you don't want that, use env -i:
Code:
export FOO=BAR
chroot / env -i bash
echo $FOO
answer:
Code:

 
Old 03-11-2009, 06:28 PM   #3
manwithaplan
Member
 
Registered: Nov 2008
Location: ~/
Distribution: Arch || Sidux
Posts: 393

Original Poster
Rep: Reputation: 45
Thanks, New with bash & and I am learning quickly. You've been helpful in both of my threads.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help: removing a variable substring from a string variable in sh script gnparsons Programming 2 06-04-2008 05:21 PM
Grep result passed to variable cornish Programming 5 11-15-2007 05:05 PM
Is there a variable that represents data passed in a pipe HGeneAnthony Linux - Newbie 1 02-27-2007 11:01 PM
setting a variable variable in a script... this works, but could it be more elegant? pwc101 Programming 3 08-18-2006 11:23 AM
sed not working if value is passed thru a variable containg value suchi_s Programming 7 10-29-2004 07:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration