Sample scripts for Windows and UNIX.
@echo off @echo. >> stest.txt @echo %date% %time% >> stest.txt @echo arg0: %0 >> stest.txt @echo arg1: %1 >> stest.txt @echo arg2: %2 >> stest.txt @echo arg3: %3 >> stest.txt @echo arg4: %4 >> stest.txt @echo arg5: %5 >> stest.txt @echo arg6: %6 >> stest.txt @echo arg7: %7 >> stest.txt @echo arg8: %8 >> stest.txt @echo arg9: %9 >> stest.txt @echo. >> stest.txt
This is a sample execution parameter string for the script above:
Time:%Time% Severity:%Severity% Resource:%Resource% Server:%Top_resource% KPI:%KPI% State:%Current_state% URL:%SCC_URL%
The script’s ouput might look like this:
Tue 12/15/2009 14:54:45.58 arg0: C:\project\sccmain\script-test.bat arg1: Time:"Mon Dec 21 21:30:04 2009" arg2: Severity:CRITICAL arg3: Resource:"SCC Tester 1" arg4: Server:"SCC Tester 1" arg5: KPI:kpi_scc_mostate_primary arg6: State:ERROR arg7: HYPERLINK "http://ik-scc.sybase.com:8282/scc"URL:http://ik-scc.sybase.com:8282/scc arg8: arg9:
This is a UNIX script. Like the Windows script above, it outputs the parameter values you pass to it to a text file.
#!/bin/sh outfile=/testing/latest/scriptTest.out echo> $outfile echo `date` >> $outfile count=1 while [ "$1" ] do echo arg$count: $1 >> $outfile shift count=`expr $count + 1` done echo --- DONE --- >> $outfile