home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / aix / 13824 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  1.7 KB

  1. Path: sparky!uunet!opl.com!hri.com!spool.mu.edu!howland.reston.ans.net!usc!sdd.hp.com!news.cs.indiana.edu!babbage.ece.uc.edu!ucunix.san.uc.edu!ewilson
  2. From: ewilson@ucunix.san.uc.edu (Eliot Wilson)
  3. Newsgroups: comp.unix.aix
  4. Subject: Re: Change standard output within a shell script
  5. Keywords: shell script cron
  6. Message-ID: <C1J781.G4u@ucunix.san.uc.edu>
  7. Date: 27 Jan 93 21:19:12 GMT
  8. References: <1jq14qINNsbd@geraldo.cc.utexas.edu>
  9. Organization: University of Cincinnati
  10. Lines: 36
  11.  
  12. In article <1jq14qINNsbd@geraldo.cc.utexas.edu> mandream@ccwf.cc.utexas.edu writes:
  13. >How do you change the definition of standard output within a csh script?
  14. >I have a shell script with a lot of "echo" commands and I want their
  15. >output to automatically go to a different file every day.  I don't want
  16. >to have to type a bunch of redirection symbols.
  17. >
  18. >The shell script is running as a cron job.  I tried to redirect the file
  19. >as follows:
  20. >
  21. >   00 2 * * 1-5 ~admin/bkup.test > ~admin/bkup_report/`date +%b_%d_%Y` 2>&1
  22. >
  23. >But, when I did that, the output was put into a file with the name
  24. >
  25. >   Fri Jan 22 02:00:00 CST 1993
  26. >
  27. >Instead of 
  28. >
  29. >   Jan_22_1993
  30. >
  31. >When I run the same command that I used in the cron at the normal ksh
  32. >prompt (since cron runs in ksh), it does create the filename I want.
  33. >
  34. >Thanks in advance...
  35.  
  36. What I have done in the past using borne shell is this
  37.  
  38. exec > /my.output.filename
  39.  
  40. This cause stdout to change to this new file. Hope it helps.
  41. -ELiot
  42.  
  43. -- 
  44. Eliot Wilson      Univ. of Cincinnati      UG Computer Science
  45.    A-in't         IBM Cincinnati AIX Open Systems Solution Team (a.k.a. limbo)
  46.    I-t              Internet:               VNET:   
  47.    X-citing       ewilson@ucunix.san.uc.edu      supewils@DETVMIC1
  48.