If I have a path like this with a symlink:
/this/one/two/three
Is there is a quick one-liner for determining if one more more segments in the path is a symlink? For example, I'd want to detect if this, one, two, or three in the example above was a symlink.
One way is to compare the path containing the symlink to the output of readlink -f <path>
. Wondering if there is a faster way.
I would use:
you can use
awk
andprint
for use in this case or other cases , it's very simple and usefully . on this case you can do bellow step : 1 = open ~/.bashrc and add bellow command end of this file2 = create a file with bellow content in
/bin/issymlink.sh
3 - logout and login or type
su
in terminal and enter finally you can typeissymlink PATH/TO/FILE/OR/DIRECTORY
in terminal and enter to check type of fileexample usage and output :
From: https://unix.stackexchange.com/questions/96907/how-do-i-check-if-a-file-is-a-symbolic-link-to-a-directory
What we see?
[[ -L ]]
- doing this job for us. Cheers.Usage: