Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

TCL help needed... Urgent!!

Status
Not open for further replies.

Sumitha Sudhakaran

Junior Member level 2
Joined
Aug 7, 2012
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Bangalore
Activity points
1,440
Suppose i have a tcl file to be run, say test.tcl.. and i want to specify the file to be tested, say test.tcl file1. wha do i do to extract "file1" from the command line and perform the test on the file.. i need a tcl command, that helps extract the argument from the command line..
 

Suppose i have a tcl file to be run, say test.tcl.. and i want to specify the file to be tested, say test.tcl file1. wha do i do to extract "file1" from the command line and perform the test on the file.. i need a tcl command, that helps extract the argument from the command line..

All Tcl scripts have access to three predefined variables.
$argc - number items of arguments passed to a script.
$argv - list of the arguments.
$argv0 - name of the script.

Code:
puts "Script Name is" 
puts [lindex $argv0] 
puts "second Argument is"
puts [lindex $argv 0]
puts "Third Argument is"
puts [lindex $argv 1]


Eg.
Code:
tclsh argtest.tcl myarg1 myarg2



output
Script Name is
argtest.tcl
second Argument is
myarg1
Third Argument is
myarg2
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top