How to find all soft links (symbolic links) in current directory


Question relates to shell-scripting in bash.

How to check with a script which files within the current directory are soft links?

In case I have used the wrong term, when I say soft links, I am referring to files created using ln -s.

The only thing I have managed to think of is to evaluate ls -la as an expression, and parse its results, but obviously this is not the best solution.

Best Answer

See 'CONDITIONAL EXPRESSIONS' in man bash – in this case you want -h:

for file in *
  if [ -h "$file" ]; then
    echo "$file"