Você já tentou
pwd -P
Funciona para mim (usando zsh).
$ ls -l
drwxrwxr-x 2 xxxxxxx xxxxxxx 4096 Aug 28 10:14 a
lrwxrwxrwx 1 xxxxxxx xxxxxxx 1 Aug 28 10:15 b -> a
$ cd b
$ pwd
/home/xxxxxxx/temp/b
$ pwd -P
/home/xxxxxxx/temp/a
suponha que eu tenha uma cadeia de links simbólicos A - > B - > C
quando eu digito pwd, pode mostrar-me em A, B ou C, dependendo de como eu chego aqui.
Como mostro o endereço do diretório físico, ou seja, não é representado por nenhum link simbólico?
Você já tentou
pwd -P
Funciona para mim (usando zsh).
$ ls -l
drwxrwxr-x 2 xxxxxxx xxxxxxx 4096 Aug 28 10:14 a
lrwxrwxrwx 1 xxxxxxx xxxxxxx 1 Aug 28 10:15 b -> a
$ cd b
$ pwd
/home/xxxxxxx/temp/b
$ pwd -P
/home/xxxxxxx/temp/a
**pwd -P** . readlink -f . (%código%). man info coreutils readlink
mas até mesmo para qualquer outro arquivo realpath .
Seu realpath \my\long\path\file.ext geralmente tem um comando pwd usado em vez de shell .
Se você escrever em um shell /bin/pwd , ele responderá se o seu shell fornecer uma versão incorporada.
Para a ajuda correta, você pode consultar
type pwd geralmente para o comando man pwd \bin\pwd e depois da pesquisa de man bash para a versão incorporada. pwd para os outros shells (zsh, csh, tcsh ...) De man <TheShellName> , por exemplo você pode ler
pwd [-LP]
Print the absolute pathname of the current working directory. The pathname printed contains no symbolic links if the -P option is supplied or the -o physical option to the set builtin command is enabled. If the -L option is used, the pathname printed may contain symbolic links. The return status is 0 unless an error occurs while reading the name of the current directory or an invalid option is supplied.
Você pode usar o readlink (se disponível em sua distro) no diretório atual:
$ readlink -f .
ou com um caminho completo:
$ readlink -f /my-dir/with-some-link
rhel / centos fornece em pacote de coreutils. h.
Tags bash symbolic-link linux