Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2012

    Unanswered: declaring global variable in unix(ksh)

    Hi All,
    I'm trying to create a global variable in unix as below..

    export var=value

    when i use "echo $var" i'm able to see the mentioned value, but when i log out and login the value is gone. What is the scope of global variable?
    I want to use that in many other scripts.

    Can anyone help me how to set this global variable permanently to some value.


  2. #2
    Join Date
    Sep 2009
    Provided Answers: 1
    The variable lasts for as long as the process_id lasts.
    If you want to have it available every time you log in, add it to your .profile.
    If you want to be able to change it, and save the changed value, you have to save the new value to a data file (before you log out), and read that data file on the next log in.

  3. #3
    Join Date
    Oct 2012
    Thank You.

Posting Permissions

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