LinuxQuestions.org
Review your favorite Linux distribution.
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, 07: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, 12:06 PM   #2
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
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, 07: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 06:21 PM
Grep result passed to variable cornish Programming 5 11-15-2007 06:05 PM
Is there a variable that represents data passed in a pipe HGeneAnthony Linux - Newbie 1 02-28-2007 12:01 AM
setting a variable variable in a script... this works, but could it be more elegant? pwc101 Programming 3 08-18-2006 12:23 PM
sed not working if value is passed thru a variable containg value suchi_s Programming 7 10-29-2004 08:41 AM


All times are GMT -5. The time now is 08:39 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration