Advertisement
IchHabRecht

[BASH] Check symbol links

Jan 14th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.33 KB | None | 0 0
  1. for file in *; do
  2.     if [[ -L "$file" ]]; then echo "$file is a symlink"; else echo "$file is not a symlink"; fi
  3. done
  4.  
  5. for file in *; do
  6.     if [[ -d "$file" ]]; then echo "$file is a directory"; else echo "$file is a regular file"; fi
  7. done
  8.  
  9. if [[ -L "$file" && -d "$file" ]]
  10. then
  11.     echo "$file is a symlink to a directory"
  12. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement