Supponiamo che io sia in /path/to/dir . All'interno di questa directory c'è un'altra directory chiamata subdir .
C'è un comando che posso emettere che restituisce il percorso completo a subdir , non importa come viene identificato? Ad esempio:
$ cmd subdir
/path/to/dir/subdir
$ cmd /path/to/dir/subdir
/path/to/dir/subdir
Risposta accettata:
coreutils ' realpath fa il trucco:
realpath subdir
e funziona comunque viene specificata la directory (o il file):
realpath /blah/blah2/subdir
realpath ../blah2/subdir