[HPADM] RE: Scripting Question

Peter.Heick_at_sas.dk
Date: 08/13/03

  • Next message: david fox: "[HPADM] Capacity Planning question."
    To: hpux-admin@dutchworks.nl
    Date: Wed, 13 Aug 2003 15:45:42 +0200
    
    

    Hi Dan

    Will this solve your problem ?

    (command; echo $?) | tee outputfile

    return=`tail -1 outputfile`

    / Peter

    -----Original Message-----
    From: Dan.Johansson@swisscom.com [mailto:Dan.Johansson@swisscom.com]
    Sent: Wednesday, August 13, 2003 3:31 PM
    To: hpux-admin@dutchworks.nl
    Subject: [HPADM] Scripting Question

    Hi Gurus!

    I've a small scripting Question.

    I would like to do something like this.

    command | tee outputfile

    The problem is that I want toi get the return-code ($?) from the command
    and NOT from tee. If I do it as I've shown above i'll only get the
    returncode from tee.

    I can not send the output to a log-file and then do a cat of the file
    because I need to se the output as the command is running.

    Any suggestions on how to solve this problem?

    Regards,
    Dan Johansson
    Unix Systems Engineer
    MC-TO-MIT-SYI-UNS

    Mobile +41 (0)79 663 13 48
    Dan.Johansson@swisscom.com

    Swisscom Mobile Ltd, MC-TO-MIT-SYI-UNS, CH-3050 Bern
    Location: Poststrasse 25, CH-3072 Ostermundigen
    Phone +41 (0)31 342 51 57, Fax +41 (0)31 342 16 98,
    www.swisscom-mobile.ch

    This e-mail may contain confidential and/or privileged information. If
    you are not the intended recipient (or have received this e-mail in
    error) please notify the sender immediately and delete this e-mail. Any
    unauthorised copying, disclosure or distribution of the material in this
    e-mail is strictly forbidden.

    --
                 ---> Please post QUESTIONS and SUMMARIES only!! <---
            To subscribe/unsubscribe to this list, contact
    majordomo@dutchworks.nl
           Name: hpux-admin@dutchworks.nl     Owner:
    owner-hpux-admin@dutchworks.nl
     
     Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse
    only)
                http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse &
    search)
    --
                 ---> Please post QUESTIONS and SUMMARIES only!! <---
            To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
           Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
     
     Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
                http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)
    

  • Next message: david fox: "[HPADM] Capacity Planning question."

    Relevant Pages

    • [HPADM] SUMMARY Scripting Question
      ... (command; echo $?) ... ret=$(tail -1 outputfile) ... To subscribe/unsubscribe to this list, ...
      (HP-UX-Admin)
    • Is tcl/tk the solution?
      ... I am relatively new to tcl and am currently trying to establish if it can ... readily satisfy my requirements. ... I have an application written in Fortran, which is passed command line ... ability to type in the outputfile name or select it from a browser. ...
      (comp.lang.tcl)
    • Re: Is tcl/tk the solution?
      ... > readily satisfy my requirements. ... > ability to type in the outputfile name or select it from a browser. ... > should also display the command line and pass the command line to ... proc getFile { ...
      (comp.lang.tcl)
    • Re: Linux measuring elapsed time for a shell command
      ... > executed and the time statistics are reported on screen. ... > the command output to a file or pipe the time statistics will only go ... (to end the script session) ... Now the output of everything that went to your terminal is in outputfile, ...
      (comp.os.linux.misc)
    • Re: PS3 select menu to screen and file?
      ... > I use inbuilt menu functionality with ksh e.g. ... > This outputs a menu to screen and takes care of user input. ... yourMenuCmd | tee outputFile ... yourMenuCmd | tee -a outputFile ...
      (comp.unix.shell)