- 论坛徽章:
- 145
|
本帖最后由 jason680 于 2014-01-13 16:38 编辑
回复 7# springlie
Usually, I will program one transfer utility to generate two script from one source code.
1. define back slash with space
WS="\\ "
2. use empty for default value of msg
msg=""
3. add more case for -r, -g, -hl, ....
-r | -red )
change to
-r | \ -r| -red | \ -red )
or
-r | $WS-r| $WS-red | -red )
Note: define $WS ==> '\ '
4. defult case
*)
msg="msg$1 "
5. change help like this
-h|-help|--help )
eval $help_info
echo $help_info | sed -r 's/\\/\\\n/g'
#echo $help_src
return ;;
6. # clear and #print
# msg+=$DONE"\n"
echo -e "$DONE$msg$DONE"
finally, you will see the result as like as your picture 1.
Note: sorry, I can't upload the picture successfully that is some network or other issue.
Note: I use it on Ubuntu 12.04 with bash only
|
|