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 8868219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:13:05+00:00 2026-06-14T17:13:05+00:00

Is it possible to call a function in tcl script which is aactually defined

  • 0

Is it possible to call a function in tcl script which is aactually defined in anothe shell script? For example,

my shell script function is

add ()
{
 `a=$1
 b=$2
 c=`expr $a + $b`
`}

How to call this function inside a tcl file? please guide me with this

  • 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-14T17:13:07+00:00Added an answer on June 14, 2026 at 5:13 pm

    It isn’t really possible to call a function written in another language from Tcl except in a few ways. For example, a C function can be called if it conforms to Tcl’s command definition signature, or if some glue code is present (such as might be generated with SWIG or Critcl). The other way to call the code is by invoking it in another process, typically a subprocess. Running the command in a shell script might then be done like this (assuming your function definition is in my_script.sh):

    exec /bin/sh -c ". my_script.sh; add 123 456; echo \$c"
    

    But that’s rather clunky and inclined to cause problems when dealing with more complicated input values. I advise turning your script into a whole program that can run more directly (so you can do exec my_script.sh 123 456) or, better yet, writing it in some other language which has fewer mysterious gotchas than Unix shell (i.e., most languages!)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to call a function (defined in a shell script) from Unix
I was wondering if it was possible to call a function inside a Perl
Possible Duplicate: Can main function call itself in C++? I found this problem very
Is it possible to call a function defined in a non-specialised template class from
Why isn't it possible to call a function which takes no arguments with a
Is it possible to call a function inside an action method that will eventually
Is it possible to call Tcl procedures that have function pointers (or callback functions)
How it is possible to call a function from a other PowerShell script an
Is it possible to call a function on specific index value of nodelist which
Is it possible to call function within the same function without specifying the function

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.