home *** CD-ROM | disk | FTP | other *** search
- 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
- From: farrar@adaclabs.com (Stephen Daedalus)
- Newsgroups: comp.lang.tcl
- Subject: Re: Strange error for null returned result
- Keywords: TCL/TK, error, null, eval, exec, fgrep
- Message-ID: <1992Dec18.090123@adaclabs.com>
- Date: 18 Dec 92 17:01:23 GMT
- References: <1992Dec18.025847.26643@bnr.ca>
- Sender: farrar@firewall (Stephen Daedalus)
- Organization: The Eye of the Pyramid, Inc.
- Lines: 44
- Nntp-Posting-Host: 192.153.52.178
-
- In article <1992Dec18.025847.26643@bnr.ca>, tdoan@bnr.ca (Tuan Doan) writes:
- |> Hello,
- |>
- |> I think I encountered a very strange error condition in TCL/TK 2.3 For
- |> the following logic:
- |>
- |> set t1 [eval exec "/bin/fgrep $pat /tempdir/clip.ps"]
- |>
- |> works correctly if $pat exist in clip.ps When fgrep could not find any
- |> match and return null?, I get the following error:
- |>
- |> while executing
- |> "exec /bin/fgrep adobe /tempdir/clip.ps"
- |> ("eval" body line 1)
- |> invoked from within
- |> "eval exec /bin/fgrep adobe /tempdir/clip.ps"
- |> invoked from within
- |> "set t1 "[eval exec /bin/fgrep $pat /tempdir/clip.ps]..."
- |>
- |> I was wondering if anyone else encountered this problem. If so, what is
- |> the fix for it?
- grep and its siblings return a 0 upon a successful search and (usually) 1
- or some other non zero value upon failure. It could be that exec or eval is
- interpreting the non zero return value as an error. You say "great, so I still
- get an error". You could put a " ; echo "" > /dev/null" after your grep command
- so that it would always return a 0 and it would still set t1 correctly. What
- the heck, it`s got to work better than the truth.
- >
- |> Thanks,
- |>
- |> __ __/ / / __ / | / Tuan T. Doan
- |> / / / / / / | / Advance Signalling Design
- |> / / / __ / / | / 2201 Lakeside Blvd. P.O. Box 833871
- |> __/ ______/ __/ __/ __/ __/ Richardson, TX 75083-3871
- |> Phone: 6-444-4575/214-684-4575
- |> Internet: tdoan@bnr.ca Fax: 6-444-3716/214-684-3716
- |> or tdoan@x400gate.bnr.ca
-
- --
- ---
- Richard Farrar These views are my own, not my company's or country's.
- ADAC Laboratories "A man without hand is not a man."
- farrar@adaclabs.com - George Costanza, Seinfeld
- Spam is a registered trademark of Hormel
-