Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

CSS scripting problem

I have a css11503 running 7.30.0.05 and I am trying to install a custom script (http://www.cisco.com/en/US/products/hw/contnetw/ps789/products_tech_note09186a00801e1dfb.shtml)

I login to the CSS, execute: script record http-test <enter>

However, when I paste in the script and it gets to the initial arg length checking:

"if ${$ARGS}[#] "NEQ" "3"

It errors out and says

%% Error undefined variable.

Any idea what I am doing wrong?

Thanks!

-wP

4 REPLIES
Cisco Employee

Re: CSS scripting problem

You have one $ sign in excess.

The correct line should be

if ${ARGS}[#]

Regards,

Gilles.

Thanks for rating this answer.

New Member

Re: CSS scripting problem

I mistyped in my original post -- i entered:

if ${ARGS}[#]

and I get

%% Error undefined variable

Thanks,

-wP!

Cisco Employee

Re: CSS scripting problem

try to load the script file via ftp instead of entering it line by line.

Gilles.

New Member

I have the same problem. It

I have the same problem. It prompts an error in some lines though the "show script" seems to be ok. I'm worry about that the script won't work in production and I can test it.

I downloaded other similar scripts via FTP but FTP fails for this one, the CSS is no able to download the script from the FTP server.

Also I have downloaded via FTP similar scripts that starts with the same line (if ${ARGS}[#] "NEQ" "2".

My version is sg0820501. I know that the scripts configuration is ok cause I have it configured in other CSS.

CSS-Device# script record ap-kal-tcp-connect-graceful
Press Ctrl^C to terminate recording...

CSS-Device#
CSS-Device# if ${ARGS}[#] "NEQ" "2"
                  ^
%% Error undefined variable.

CSS-Device#         echo "Usage: xxx ip port"
Usage: xxx ip port
CSS-Device#         exit script 1
CSS-Device# endbranch
endbranch: Not in Branch command.
CSS-Device#
CSS-Device# set HostNameA "${ARGS}[1]"
                              ^
%% Error undefined variable.

CSS-Device# set PortA "${ARGS}[2]"
                          ^
%% Error undefined variable.

CSS-Device#
CSS-Device#
CSS-Device# set EXIT_MSG "ERROR: Failed to connect"
CSS-Device# socket connect host ${HostNameA} port ${PortA} tcp 2000
                                   ^
%% Error undefined variable.

CSS-Device#
CSS-Device# no set EXIT_MSG
CSS-Device# socket disconnect ${SOCKET} graceful
                                 ^
%% Error undefined variable.

CSS-Device#
CSS-Device# exit script 0
CSS-Device#
CSS-Device#
Script <ap-kal-tcp-connect-graceful> recorded.

CSS-Device# show script ap-kal-tcp-connect-graceful

if ${ARGS}[#] "NEQ" "2"
        echo "Usage: xxx ip port"
        exit script 1
endbranch

set HostNameA "${ARGS}[1]"
set PortA "${ARGS}[2]"


set EXIT_MSG "ERROR: Failed to connect"
socket connect host ${HostNameA} port ${PortA} tcp 2000

no set EXIT_MSG
socket disconnect ${SOCKET} graceful

exit script 0


CSS-Device#

130
Views
0
Helpful
4
Replies