Reputation: 3
How to verify whether a file or directory exist and is a symbolic link (soft link) on Linux?
I want to write a shell to do it.
Could you please give me some tips?
Upvotes: 0
Views: 3487
Reputation: 274532
You can use the -L
test option:
if [[ -L $file ]]; then
echo "$file exists and is a symbolic link"
fi
Upvotes: 2