Main (){ if [ ! -z $A ];then RES="${A}" fi if [ ! -z $B ];then RES+=":${B}" fi if [ ! -z $C ];then RES+="\\${C}" fi if [ ! -z $D ];then RES+="//${D}" fi echo $RES } while test -n "$1"; do case "$1" in --protocol | -p) PROTOCOL=$2 shift ;; --a ) A=$2 shift;; --b ) B=$2 shift;; --c ) C=$2 shift;; --d ) D=$2 shift;; *) echo "Unknown argument: $1" exit $STATE_UNK ;; esac shift done Main