Added USR1 handling
[clearscm.git] / bin / findsymlinks.sh
1 #!/bin/bash
2
3 path=$1
4
5 if [ -z "$path" ]; then
6   echo "Usage $0 <path>"
7   exit 1
8 fi
9
10 IFS='/' read -ra components <<< "$path"
11
12 testpath=''
13
14 for component in "${components[@]}"; do
15   [ -z "$component" ] && continue
16
17   testpath="${testpath}/$component"
18
19   if [ -h "$testpath" ]; then
20     points_to=$(ls -l $testpath | awk '{print $NF}')
21
22     echo "$testpath: symbolic link to $(ls -l $testpath | awk '{print $NF}')"
23     testpath=$(readlink -n $testpath)
24   fi
25 done
26