Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Environment variables 2

Status
Not open for further replies.

cardy

Technical User
Sep 5, 2000
33
GB
I have a requirement to change a string of characters that appears in any of my environment variables to a new string and apply the changes to my current unix session. I have this so far :
env | sed "s/^/export /" | sed "s/old/new"

I now wish to run the output from this command to update my current unix session via the . (dot) command. How can I do this without writing the output to a temp file and running that. I'd like to pipe the output from the above to the . command, something like this :
env | sed "s/^/export /" | sed "s/old/new" | .
or
env | sed "s/^/export /" | sed "s/old/new" | . -

but neither works.

Can you help

TIA

Cardy

 
Thanks Ged, that worked a treat.
 
cardy,

`env | sed "s/^/export /" | sed "s/old/new/"` sh

this works b'cos &quot;<set env var.> cmd args&quot; is allowed.
to get the set env var. export stmts i am using back ticks.

hope this helps,

afaik,
shail

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top