| 1 | #!/bin/bash |
| 2 | # symlinks.sh: Lists symbolic links in a directory. |
| 3 | |
| 4 | OUTFILE=symlinks.list # save-file |
| 5 | |
| 6 | directory=${1-`pwd`} |
| 7 | # Defaults to current working directory, |
| 8 | #+ if not otherwise specified. |
| 9 | |
| 10 | |
| 11 | echo "symbolic links in directory \"$directory\"" > "$OUTFILE" |
| 12 | echo "---------------------------" >> "$OUTFILE" |
| 13 | |
| 14 | for file in "$( find $directory -type l )" # -type l = symbolic links |
| 15 | do |
| 16 | echo "$file" |
| 17 | done | sort >> "$OUTFILE" # stdout of loop |
| 18 | # ^^^^^^^^^^^^^ redirected to save file. |
| 19 | |
| 20 | # echo "Output file = $OUTFILE" |
| 21 | |
| 22 | exit $? |