Find the answer to your Linux question:
Results 1 to 3 of 3
Occasionally some stupid things come to mind. This is one of them. Suppose we read a shell variable like this: Code: $ read a 12 $ echo $a 12 How ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! kdev981's Avatar
    Join Date
    Dec 2007
    Location
    Hyderabad,(A.P.) India.
    Posts
    14

    Question Removing a shell variable


    Occasionally some stupid things come to mind. This is one of them.
    Suppose we read a shell variable like this:

    Code:
    $ read a
    12
    $ echo $a
    12
    How can I delete this variable "a" now, without logging out or rebooting?

    Thanks in advance.

  2. #2
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    "unset a" will get rid of it. Alternatively, "a=" will empty it so to all intents and purposes it's gone.

  3. #3
    Just Joined! kdev981's Avatar
    Join Date
    Dec 2007
    Location
    Hyderabad,(A.P.) India.
    Posts
    14
    Thanks a lot!!

Posting Permissions

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