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

  • Home
  • SEARCH
  • 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 7807777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:57:32+00:00 2026-06-02T02:57:32+00:00

I am trying to implement something which my logic says can’t be done. But

  • 0

I am trying to implement something which my logic says can’t be done. But I need your help to understand why can’t it be.

Short Version of Question

Is it possible to log stdout+stderr of a script in csh without using file redirection ( >& or tee ).


Detailed Explanation of Question

I have a requirement with a csh script (script1) where I am not allowed to use file redirection.(I will give the reason in a while)
So that means I can’t use something like

echo just checking >& logfile

hence I can’t use this or tee to create my logfile.
I also have a another script (script2) which is a top level script.

I can either run script1 in standalone mode or through script2.

In either case i need to create a log(stdout+stderr) of script1 in logfile.

There are two possible(but not complete) option for that

write this line in script2

./script1 >& logfile

But then I can’t log script1 in logfile when script1 is run in standalone mode.

Another option is to use file redirections in script1 like this:

echo test starting >> logfile
echo test over

In this case thee are two disadvantages:
1) “test over” prints before “test starting” , i.e. the order of occurring of command logs is not certain.
2) It’s tedious to put >>& after every statement if I am intending to cover whole script.

Now is there any other way,I can get what I need. That is I can run script1 without file redirection and still get to log its stdout+stderr in logfile.

  • 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-02T02:57:35+00:00Added an answer on June 2, 2026 at 2:57 am

    You mention csh, so this may not help you. On the other had, it may motivate you to stop using csh for scripts, a task for which it is notoriously inappropriate. In sh, you can simply do:

    #!/bin/sh
    exec > logfile 2>&1
    echo foo
    

    To write foo (and the output and errors of all subsequent commands) to the logfile

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

Sidebar

Related Questions

I'm trying to implement something similar to what http://www.ancestry.com has, but I'm not sure
I'm trying to implement something quite simple but I'm on my first steps in
I am presently doing a project with menus and trying to implement something which
I'm trying to achieve something which I'm sure is pretty simple but I cannot
All I am currently trying implement something along the lines of dim l_stuff as
I'm trying to implement something like this: <div> <table> <thead> <tr> <td>Port name</td> <td>Current
I'm trying to implement an archive functionality into a webpage that will submit something
I am trying to implement a text box that, when the user types something,
Ok well I'm trying implement something similar to the 'undo' function in many image
I am trying to implement something similar to the share feature on Dropbox that

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.