home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / tcl / 2150 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  2.4 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!spool.mu.edu!olivea!decwrl!netcomsv!firewall!farrar
  2. From: farrar@adaclabs.com (Stephen Daedalus)
  3. Newsgroups: comp.lang.tcl
  4. Subject: Re: Strange error for null returned result
  5. Keywords: TCL/TK, error, null, eval, exec, fgrep
  6. Message-ID: <1992Dec18.090123@adaclabs.com>
  7. Date: 18 Dec 92 17:01:23 GMT
  8. References: <1992Dec18.025847.26643@bnr.ca>
  9. Sender: farrar@firewall (Stephen Daedalus)
  10. Organization: The Eye of the Pyramid, Inc.
  11. Lines: 44
  12. Nntp-Posting-Host: 192.153.52.178
  13.  
  14. In article <1992Dec18.025847.26643@bnr.ca>, tdoan@bnr.ca (Tuan Doan) writes:
  15. |> Hello,
  16. |> 
  17. |>    I think I encountered a very strange error condition in TCL/TK 2.3   For
  18. |> the following logic:
  19. |> 
  20. |>    set t1 [eval exec "/bin/fgrep $pat /tempdir/clip.ps"]
  21. |> 
  22. |> works correctly if $pat exist in clip.ps   When fgrep could not find any
  23. |> match and return null?, I get the following error:
  24. |> 
  25. |>     while executing
  26. |> "exec /bin/fgrep adobe /tempdir/clip.ps"
  27. |>     ("eval" body line 1)
  28. |>     invoked from within
  29. |> "eval exec /bin/fgrep adobe /tempdir/clip.ps"
  30. |>     invoked from within
  31. |> "set t1 "[eval exec /bin/fgrep $pat /tempdir/clip.ps]..."
  32. |> 
  33. |> I was wondering if anyone else encountered this problem.  If so, what is
  34. |> the fix for it?
  35. grep and its siblings return a 0 upon a successful search and (usually) 1
  36. or some other non zero value upon failure.  It could be that exec or eval is
  37. interpreting the non zero return value as an error.  You say "great, so I still
  38. get an error".  You could put a " ; echo "" > /dev/null" after your grep command
  39. so that it would always return a 0 and it would still set t1 correctly.  What
  40. the heck, it`s got to work better than the truth.
  41. |> Thanks,
  42. |> 
  43. |>  __  __/  /   /   __  /    |   /    Tuan T. Doan
  44. |>     /    /   /   /   /   / |  /     Advance Signalling Design
  45. |>    /    /   /   __  /   /  | /      2201 Lakeside Blvd.  P.O. Box 833871
  46. |> __/  ______/ __/ __/ __/  __/       Richardson, TX 75083-3871
  47. |>                                     Phone: 6-444-4575/214-684-4575
  48. |> Internet:  tdoan@bnr.ca             Fax:   6-444-3716/214-684-3716
  49. |>       or   tdoan@x400gate.bnr.ca    
  50.  
  51. -- 
  52. ---
  53. Richard Farrar        These views are my own, not my company's or country's.
  54. ADAC Laboratories    "A man without hand is not a man."
  55. farrar@adaclabs.com        - George Costanza, Seinfeld
  56.         Spam is a registered trademark of Hormel
  57.