I tried to run
readlink -f
on multiple files by usingwildcard "*"
, but it evaluates other files as operandCommand
readlink -f *log
Output (desired)
/home/trail_1.log /home/trail_2.log
Am I doing something wrong ?
I am usingtcsh
andreadlink
is only command I am aware to read path of file.
Answer
You can also use realpath
:
% realpath *
/data/code/mdweb/Gemfile
/data/code/mdweb/Gemfile.lock
/data/code/mdweb/README.markdown
realpath
is not POSIX. It is available by default on FreeBSD systems, and on some (but not all) Linux systems (but AFAIK can be installed as a package on most, if not all, Linux systems).
realpath
‘s behaviour might be different across implementations, so the above behaviour is not guaranteed to work. I’ve tested it on FreeBSD 10 & Arch Linux.
Attribution
Source : Link , Question Author : JigarGandhi , Answer Author : Martin Tournoij