• Making Variable Value Changes Permanent
  • HISTSIZE=0 Listing 7-1: Changing the value of  HISTSIZE 74




    Download 7,3 Mb.
    Pdf ko'rish
    bet88/125
    Sana14.05.2024
    Hajmi7,3 Mb.
    #232858
    1   ...   84   85   86   87   88   89   90   91   ...   125
    Bog'liq
    linuxbasicsforhackers

    HISTSIZE=0
    Listing 7-1: Changing the value of 
    HISTSIZE


    74
    Chapter 7
    Now, when you try to use the up- and down-arrow keys to recall your 
    commands, nothing happens because the system no longer stores them. 
    This is stealthy, although it can be inconvenient.
    Making Variable Value Changes Permanent
    When you change an environment variable, that change only occurs in that 
    particular environment; in this case, that environment is the bash shell 
    session. This means that when you close the terminal, any changes you 
    made are lost, with values set back to their defaults. If you want to make the 
    changes permanent, you need to use the 
    export
    command. This command 
    will export the new value from your current environment (the bash shell) to 
    any new forked child processes. This allows the new process to inherit the 
    exported variables.
    Variables are strings, so if you run on the cautious side, it isn’t a bad 
    idea to save the contents of a variable to a text file before you modify it. 
    For example, since we’re about to change the 
    PS1
    variable, which controls 
    the information you display in the prompt, first run the following com-
    mand to save the existing values to a text file in the current user’s home 
    directory:
    kali >
    echo $HISTSIZE> ~/valueofHISTSIZE.txt
    This way, you can always undo your changes. If you want to be even 
    more cautious and create a text file with all the current settings, you can 
    save the output of the 
    set
    command to a text file with a command like 
    this one:
    kali >
    set> ~/valueofALLon01012019.txt
    After you’ve changed a variable, as we did in Listing 7-1, you can make 
    the change permanent by entering 
    export
    and then the name of the variable 
    you changed, as shown here:
    kali >
    export HISTSIZE
    Now the 
    HISTSIZE
    variable will still be set to 0 in this environment and 
    will no longer store your commands. If you want to reset the 
    HISTSIZE
    vari-
    able to 1,000, simply enter this:
    kali >

    Download 7,3 Mb.
    1   ...   84   85   86   87   88   89   90   91   ...   125




    Download 7,3 Mb.
    Pdf ko'rish

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    HISTSIZE=0 Listing 7-1: Changing the value of  HISTSIZE 74

    Download 7,3 Mb.
    Pdf ko'rish