29 lines
373 B
Plaintext
29 lines
373 B
Plaintext
|
#!/bin/sh
|
||
|
|
||
|
if [ "$1" = "-h" ]; then
|
||
|
cat <<EOF>&2
|
||
|
Usage: ${0##*/} PATH
|
||
|
|
||
|
Display PATH one entry per line. If PATH is not provided, use \$PATH by default.
|
||
|
|
||
|
EOF
|
||
|
exit
|
||
|
fi
|
||
|
|
||
|
if [ $# -ne 0 ]; then
|
||
|
ARG="$1"
|
||
|
else
|
||
|
ARG="$PATH"
|
||
|
fi
|
||
|
|
||
|
case "$ARG" in
|
||
|
*:*) SEP=':';;
|
||
|
*\;*) SEP=';';;
|
||
|
*/*) SEP='/';;
|
||
|
*,*) SEP=',';;
|
||
|
*\|*) SEP='|';;
|
||
|
*) SEP=':';;
|
||
|
esac
|
||
|
|
||
|
echo "$ARG" | awk -v RS=$SEP '1'
|