bash: set - Always display the physical directory and not the symbolic link path.



  • Take into account the main readme for this section. README first.

    Description of set -P: If set, do not resolve symbolic links when executing commands such as cd which change the current directory.

    The documents directory has a symbolic link.

    $ pwd
    /home/training/Documents
    $ ls -l
    total 0
    lrwxrwxrwx. 1 training training 11 Jul  8 10:07 src -> ../scripts/
    

    Without the set -P command, the result is:

    $ cd src
    $ pwd
    /home/training/Documents/src
    

    Setting the set -P gives the following result.

    $ set -P
    $ cd Documents/
    $ pwd
    /home/training/Documents
    $ ls -l
    total 0
    lrwxrwxrwx. 1 training training 11 Jul  8 10:07 src -> ../scripts/
    $ cd src
    $ pwd
    /home/training/scripts
    

Log in to reply
 

© Lightnetics 2024