IchHabRecht icon

[BASH] Check symbol links

IchHabRecht | PRO | 01/14/15 09:47:13 AM UTC | 0 ⭐ | 414 👁️ | Never ⏰ | []
Bash |

330 B

|

None

|

0 👍

/

0 👎

for file in *; do
    if [[ -L "$file" ]]; then echo "$file is a symlink"; else echo "$file is not a symlink"; fi
done
 
for file in *; do
    if [[ -d "$file" ]]; then echo "$file is a directory"; else echo "$file is a regular file"; fi
done
 
if [[ -L "$file" && -d "$file" ]]
then
    echo "$file is a symlink to a directory"
fi

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎