1234567891011121314151617181920212223242526272829 |
- #!/bin/bash
-
- dissect() {
- echo $* | perl -pe '
- s|(\w)(/[^/])|$1\n $2|;
- s|\?|\n ?\n |;
- s|#|\n #\n |;
- s|&|&\n |g;'
- echo ""
- }
-
- main() {
- local url=$1
- local i=0
- if [[ -n "$url" ]]; then
- dissect "$url"
- else
- i=0
- while read -r url;
- do
- if [[ -z "$url" ]]; then exit 0; fi
- i=`expr $i + 1`
- printf "=== url %02d =============================================\n" $i
- dissect "$url"
- done
- fi
- }
-
- main "$@"
|