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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:25:39+00:00 2026-06-14T07:25:39+00:00

I am trying to run a csh script from a tcl script. The tcl

  • 0

I am trying to run a csh script from a tcl script.

The tcl script below calls a csh script

#!/usr/bin/tclsh


set scripts_path /scratch/TCL_scripts/scripts_adders

set synthesis /scratch/TCL_scripts/synthesis.csh


set files [glob -directory $scripts_path *]
split $files
set files [lsort $files]
set i 1

foreach script $files {

     puts "hello"
     # puts [pwd]
     exec /bin/csh -c $synthesis
     puts $i

}

And the (begining of the) csh file is below:

#!/bin/csh -f


echo abcdefgh

When I only execute the csh file from my unix terminal, it works fine.
When I call my Tcl script, it runs and indeed writes “hello” and prints i, but the csh file is not executed because “abcdefgh” never appears in the terminal. I have also tried other commands, and I always have the same problem: the csh script is never executed when I run it from a Tcl script, even though it runs fine when I run it directly from the terminal.

(Both my Tcl script ans csh script are executable)

What must I do in order to run my csh script from my Tcl script ?

Thank you very much

  • 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-14T07:25:41+00:00Added an answer on June 14, 2026 at 7:25 am

    The csh script is indeed run for you, but by default its standard output becomes the result of the Tcl exec command (and if it produced anything on standard error, that would become an error result of the exec). To make the output and error appear on the terminal, you have to modify the exec like this:

    exec /bin/csh -c $synthesis >@stdout 2>@stderr
    

    The >@ says “redirect standard output to the following channel” (stdout in this case), and the 2>@ does the same for standard error.

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

Sidebar

Related Questions

I'm trying to write a shell script that, when run, will set some environment
I am trying run a program from a qmake .pro file which modifies the
Im trying to run a script for a project, the goal is simple :
Trying to run a MySQL script via Python and it keeps giving me errors.
I trying to run a Perl script to read an YAML file, but I
I am trying to create a script that will run a program on each
Trying to run some sql in a pl/sql procedure. Select field from schema.view; I
Trying to run a simple svn list svn+ssh://... from within jenkins on os X,
I am trying to run the C libraries from SIGAR API. In the include
Trying to run scrapy crawl command using crontab under virtual environment, and getting below

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.