summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-09-02 12:02:59 -0500
committerJohn Southworth <john.southworth@vyatta.com>2011-09-02 12:02:59 -0500
commit952308d2431bb3d65e24530ede14aa404c2fc518 (patch)
tree0a62b85df4b2f525caeca53706e25f877f0f7768
parent2dba098b93fce105b88045d7068767469c79e519 (diff)
downloadvyatta-cfg-952308d2431bb3d65e24530ede14aa404c2fc518.tar.gz
vyatta-cfg-952308d2431bb3d65e24530ede14aa404c2fc518.zip
Fix problems when using negative values
-rw-r--r--functions/interpreter/vyatta-cfg-run17
1 files changed, 8 insertions, 9 deletions
diff --git a/functions/interpreter/vyatta-cfg-run b/functions/interpreter/vyatta-cfg-run
index 4e151fa..f7b109c 100644
--- a/functions/interpreter/vyatta-cfg-run
+++ b/functions/interpreter/vyatta-cfg-run
@@ -317,7 +317,7 @@ vyatta_config_run ()
echo Incomplete command
return 1
fi
- /opt/vyatta/bin/vyatta-op-cmd-wrapper $@
+ /opt/vyatta/bin/vyatta-op-cmd-wrapper "$@"
}
### End Top level command wrappers ###
@@ -326,7 +326,6 @@ vyatta_config_run ()
vyatta_cfg_cmd_run ()
{
local cmd=$1
- local -a args=( "$@" )
local output=''
if [[ "$cmd" == "edit" ]]; then
vyatta_config_edit "${@:2}"
@@ -334,7 +333,7 @@ vyatta_cfg_cmd_run ()
vyatta_config_show "${@:2}"
else
cmd="/opt/vyatta/sbin/my_$cmd"
- output=$($cmd "${args[@]:1}")
+ output=$($cmd "${@:2}")
fi
vyatta_cfg_print_output "$output"
}
@@ -361,7 +360,7 @@ vyatta_cfg_validate_cmd ()
else
path="$path $arg"
fi
- if ! cli-shell-api validateTmplPath ${editlvl} ${path}; then
+ if ! cli-shell-api validateTmplPath -- ${editlvl} ${path}; then
_cli_shell_api_comp_values=()
vyatta_cli_shell_api getCompletionEnv $cmd ${path}
if [[ "${#_cli_shell_api_comp_values[@]}" != "1"
@@ -411,15 +410,15 @@ vyatta_config_copy ()
param2=( "${expanded_api_args[@]}" )
if [[ "${args[3]}" != "to" ]]; then
echo -ne "\n Invalid command: $cmd ${param1[@]:1} ${args[3]} ${param2[@]:1}\n\n"
- elif cli-shell-api validateTmplPath ${editlvl[*]} "${param1[@]:1}" &&
- cli-shell-api validateTmplPath ${editlvl[*]} "${param2[@]:1}" ; then
+ elif cli-shell-api validateTmplPath -- ${editlvl[*]} "${param1[@]:1}" &&
+ cli-shell-api validateTmplPath -- ${editlvl[*]} "${param2[@]:1}" ; then
cmd="/opt/vyatta/sbin/my_$cmd"
output=$(eval "$cmd ${param1[@]:1} to ${param2[@]:1} | sed -e 's/^/ /'")
if [[ ! -z "${output}" ]];then
echo -ne "\n${output}\n\n"
fi
else
- if ! cli-shell-api validateTmplPath ${editlvl[*]} "${param1[@]:1}"; then
+ if ! cli-shell-api validateTmplPath -- ${editlvl[*]} "${param1[@]:1}"; then
_cli_shell_api_comp_values=()
vyatta_cli_shell_api getCompletionEnv $cmd ${param1[1]}
if [[ "${#_cli_shell_api_comp_values[@]}" != "1"
@@ -429,7 +428,7 @@ vyatta_config_copy ()
else
echo -ne "\n Invalid command: $cmd [${param1[1]}]\n\n"
fi
- elif ! cli-shell-api validateTmplPath ${editlvl[*]} "${param1[@]:2}"; then
+ elif ! cli-shell-api validateTmplPath -- ${editlvl[*]} "${param1[@]:2}"; then
_cli_shell_api_comp_values=()
vyatta_cli_shell_api getCompletionEnv $cmd "${param2[1]}"
if [[ "${#_cli_shell_api_comp_values[@]}" != "1"
@@ -481,7 +480,7 @@ vyatta_cfg_cmd ()
local -a expanded_api_args=()
local editlvl=$(cli-shell-api getEditLevelStr)
vyatta_config_expand_compwords "${args[@]}"
- if cli-shell-api validateTmplPath ${editlvl[*]} "${expanded_api_args[@]:1}"; then
+ if cli-shell-api validateTmplPath -- ${editlvl[*]} "${expanded_api_args[@]:1}"; then
vyatta_cfg_cmd_run "${expanded_api_args[@]}"
else
# find broken portion of command