Results 1 to 2 of 2

Thread: export variables through environ or system is not being updated

  1. #1
    Join Date
    Aug 2015
    Beans
    1

    export variables through environ or system is not being updated

    Hi,

    Actually i want to export some variables like the foll in python, but $PATH is not updated. Any help would be highly appreciated

    export TOOLS="/volume/build"
    export PATH=$TOOLS:$PATH

    os.system('export TOOLS="/volume/build"')
    os.system('export PATH=$TOOLS:$PATH')
    os.system( "echo $TOOLS")
    os.system("echo $PATH")

    Thanks
    subha

  2. #2
    Join Date
    Aug 2010
    Location
    Lancs, United Kingdom
    Beans
    1,588
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: export variables through environ or system is not being updated

    Each call to os.system invokes a different shell and the export only applies to that shell. You can do this if it helps.
    Code:
    os.system('export TOOLS="/volume/build"; export PATH=$TOOLS:$PATH; echo $TOOLS; echo $PATH')

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •