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()
$XSET -b
}
# Print command line and run command line
docmd()
# Print command line only
showcmd()
{
local i
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
"$@"
}
# Print command line only
showcmd()
# Print command line and run command line
docmd()
{
SETCOLOR_SUCCESS
echo " \$ $@"
SETCOLOR_NORMAL
showcmd "$@"
"$@"
}
# Example:
# $ command $(usearg -d "$PARAM")
# 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