root/trunk/web/readlink @ 14852
1 |
#!/bin/bash
|
---|---|
2 |
# no -e because script should never abort
|
3 |
self_dir="$(dirname "$(readlink -f "$0")")" |
4 |
|
5 |
cd "$self_dir" |
6 |
while read -r line; do |
7 |
rel_path="$line" |
8 |
trailing_slash="$(if test "${rel_path%/}" != "$rel_path"; then echo /; fi)" |
9 |
canon_abs_path="$(readlink -f "$rel_path")$trailing_slash" |
10 |
canon_rel_path="${canon_abs_path#$self_dir/}" |
11 |
echo "$canon_rel_path" |
12 |
done
|