jeudi 5 mars 2015

Absolute path from user input without losing symlinks inside


Is it possible to convert in a shell script a user input path (absolute or relative) to the absolute path but without losing the symlinks inside, e.g. /a/b/c is the current user dir and c is a symlink to /a/b/s:



input . => result /a/b/c
input ./d => result /a/b/c/d
input ../c => result /a/b/c
input /a/b/c => result /a/b/c
(readlink converts it to /a/b/s, but I need /a/b/c)


Aucun commentaire:

Enregistrer un commentaire