Me thinks the ones who coded readlink had a good reason why all but the last components of --canonicalize must exist. What would be a reason to have the last one non-existing or possible non-existing? I am quite sure the programmers had a good reason to make it so.-f, --canonicalize canonicalize by following every symlink in
every component of the given name recursively;
all but the last component must exist
-e, --canonicalize-existing canonicalize by following every symlink in
every component of the given name recursively,
all components must exist
readlink question
- Rava
- Contributor
- Posts: 5424
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
readlink question
Hi, readlink --help or man readlink say
Cheers!
Yours Rava
Yours Rava
-
- Samurai
- Posts: 137
- Joined: 18 Feb 2016, 09:25
- Distribution: Linux porteus 3.2.2 KDE
- Location: Spain
Re: readlink question
for example to be able to create a new file:
newfile does not exist when executing readlink but the path to it is a valid canonical path, so you can safely create the file with touch
if you use simply readlink or readlink -e you will get an error
of course, I'm supposing mydir and mylink currently exists, i.e.
Code: Select all
touch `readlink -f mydir/mylink/newfile`
if you use simply readlink or readlink -e you will get an error
of course, I'm supposing mydir and mylink currently exists, i.e.
Code: Select all
% mkdir -p mydir/tmp/myfolder
% ln -s tmp/myfolder mydir/mylink
% touch `readlink -f mydir/mylink/newfile`
% ls mydir/mylink
newfile