Commit 4623072e authored by Vitaly Lipatov's avatar Vitaly Lipatov

showcmd: print quote for args with spaces

parent ca1e4355
...@@ -508,23 +508,30 @@ check_display() ...@@ -508,23 +508,30 @@ check_display()
$XSET -b $XSET -b
} }
# Print command line and run command line # Print command line only
docmd() showcmd()
{ {
local i
SETCOLOR_SUCCESS SETCOLOR_SUCCESS
echo " \$ $@" echo -n " \$"
for i in "$@" ; do
# print with qoutes if args have spaces
echo -n " "
echo -n "$i" | sed -e "s|\(.* .*\)|'\1'|g"
done
echo
SETCOLOR_NORMAL SETCOLOR_NORMAL
"$@"
} }
# Print command line only # Print command line and run command line
showcmd() docmd()
{ {
SETCOLOR_SUCCESS showcmd "$@"
echo " \$ $@" "$@"
SETCOLOR_NORMAL
} }
# Example: # Example:
# $ command $(usearg -d "$PARAM") # $ command $(usearg -d "$PARAM")
# will add -d "$PARAM" if $PARAM is not empty # will add -d "$PARAM" if $PARAM is not empty
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment