echopath: support for different seperators

master
Pierre Neidhardt 2014-03-27 11:38:03 +01:00
parent b9dbb2de7c
commit 4733c373c5
1 changed files with 11 additions and 3 deletions

View File

@ -4,8 +4,7 @@ if [ "$1" = "-h" ]; then
cat<<EOF
Usage: ${0##*/} PATH
Display PATH one entry per line. If PATH is not provided, use \$PATH by
default. PATH must be a ':' separated list.
Display PATH one entry per line. If PATH is not provided, use \$PATH by default.
EOF
@ -18,4 +17,13 @@ else
ARG="$PATH"
fi
echo "$ARG" | sed 's/:/\n/g'
case "$ARG" in
*:*) SEP=':';;
*\;*) SEP=';';;
*/*) SEP='/';;
*,*) SEP=',';;
*\|*) SEP='|';;
*) SEP=':';;
esac
echo "$ARG" | awk -v RS=$SEP '1'