From 11032d8d3273eab10dd33cc1947d4de23996c355 Mon Sep 17 00:00:00 2001 From: John Southworth Date: Tue, 30 Aug 2011 18:00:17 -0500 Subject: Fix user defined wildcards such as in 'clear ip bgp *' and fix an error message to be consistent --- functions/interpreter/vyatta-op-run | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/functions/interpreter/vyatta-op-run b/functions/interpreter/vyatta-op-run index 4d223df..883e03e 100644 --- a/functions/interpreter/vyatta-op-run +++ b/functions/interpreter/vyatta-op-run @@ -124,7 +124,11 @@ _vyatta_op_run () i=1 declare -a args # array of expanded arguments for arg in "$@"; do - arg=( $(_vyatta_op_conv_node_path $tpath $arg) ) # expand the arguments + if [[ $arg == "*" ]]; then + arg="*" #leave user defined wildcards alone + else + arg=( $(_vyatta_op_conv_node_path $tpath $arg) ) # expand the arguments + fi # output proper error message based on the above expansion if [[ "${arg[1]}" == "ambiguous" ]]; then echo -ne "\n Ambiguous command: ${args[@]} [$arg]\n" @@ -140,16 +144,16 @@ _vyatta_op_run () return 1 fi - args[$i]=$arg if [ -f "$tpath/$arg/node.def" ] ; then tpath+=/$arg elif [ -f $tpath/node.tag/node.def ] ; then tpath+=/node.tag else - echo "Invalid command" >&2 + echo -ne "\n Invalid command: ${args[@]} [$arg]\n\n" >&2 eval $restore_shopts return 1 fi + args[$i]=$arg let "i+=1" done -- cgit v1.2.3