Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8385005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:33:29+00:00 2026-06-09T17:33:29+00:00

Normally I invoke my tcl script under shell like this. > tclsh8.5 mytest.tcl -opt1

  • 0

Normally I invoke my tcl script under shell like this.

> tclsh8.5 mytest.tcl -opt1 foo -opt2 bar

In case need to launch gdb to debug due to some modules implemented in C++. I have to launch tclsh via gdb. So the question is how to execute my script in tcl sh with arguments.

I need something like:

tclsh> run mytest.tcl -opt1 foo -opt2 bar

Using exec is not ideal as it folks another process and losses my breakpoints settings.

tclsh> exec mytest.tcl -opt1 foo -opt2 bar
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:33:31+00:00Added an answer on June 9, 2026 at 5:33 pm

    I would think something like the following should work for you:

    set argv [list -opt1 foo -opt2 bar]
    set argc 4
    source mytest.tcl
    

    So set argv and argc to get the arguments correct and then just source in your Tcl code to execute.

    Alternatively the gdb run command allows you to pass command line arguments to the executable to be debugged. So if your debugging tclsh then the what is the problem with the run command as follows?

    run mytest.tcl -opt1 foo -opt2 bar
    

    For example under cygwin I’m able to do the following:

    $ tclsh test.tcl
    This is a test
    $ gdb -q tclsh.exe
    (no debugging symbols found)
    (gdb) run test.tcl
    Starting program: /usr/bin/tclsh.exe test.tcl
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Normally we have to do like this to invoke a function from a function
Normally, if I want to start a new activity I can use StartActivity(typeof(foo)); This
Normally the XML files I have to parse are like this: <row id=1> <title>widget<title>
Starting with a class like this: class FooClass(object): @staticmethod def static_method(x): print x normally,
Normally, you don't actually edit a file in vim. If you run vim foo
I have a PowerShell script that needs to run normally, and also when invoked
The segments in a URI normally follow this pattern in Codeigniter: XYZ.com/Class/Method/param1/param2 This works
recently I was trying to do something like this in WP7 app I have
I would like to create a new dynamic chart control. This chart will have
The default value of the selectionListener attribute for an af:table component normally looks like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.