When I run the following command, where symlinked-dir
is just that - a symlink to another directory, cat
complains that there is no such file. There is, indeed, no such file - it's created in the parent directory of the real path instead, but it contains the the path through the symlink outputted by pwd
, so at least cd
and pwd
know where they are, link-wise. I want the redirect to know it too.
cd symlinked-dir && echo $(pwd) >> ../tmp && cd .. && cat tmp
So, what modifications should I make to get the above command work?
Edit: the shell is Bash on either Debian or Gentoo (both work the same way).
realpath -s
does just that, as opposed to justrealpath
. – Eugene Ryabtsev Oct 08 '19 at 08:34