Article View: ch.comp.os.linux
Article #18125Re: Problem mit grep-Umleitung in shellscript
From: Joerg Hau
Date: Wed, 05 Apr 2000 00:00
Date: Wed, 05 Apr 2000 00:00
41 lines
1686 bytes
1686 bytes
On Mon, 03 Apr 2000, I wrote:
[snip]
>die Zeile mit "grep" liefert keinen Output!
>
>--- snip ---
>#! /bin/tcsh
>onintr cleanup
>set pfile = ("/etc/rc.config")
>
>echo "Configuration of "$HOSTNAME", as of "`date`"."
>echo " "
>
>foreach i ($pfile)
> echo " "
> echo "*** "$i " ***"
> echo " "
> echo $i
> cat $i | grep -v ^# | grep "="
> echo " "
>end
>
>cleanup:
>exit 0
>--- snip ---
.. das Problem ist inzwischen geloest. Der Haken an der Sache war, dass die
Zeile mit 'grep' von der shell nur bis zum # interpretiert wird, der Rest ist
.. nichts anderes als ein Kommentar! Ein bisschen Klammerung, und die
"korrekte" Zeile lautet:
cat $i | grep -v '^#' | grep "="
-- Joerg
------------------------------------------------------------
joerg.hau(at)swissonline.ch * Lausanne, Switzerland
Never take life seriously. You won't get out alive anyway.
------------------------------------------------------------
Technical Details
Message-ID:
<954953650.263246375@localhost>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<954795685.1431006335@localhost>Show Full Headers
Complete Article Headers
X-Google-Language: GERMAN,ASCII-7-bit X-Google-Thread: f4b73,7955a30db16a222f X-Google-Attributes: gidf4b73,public From: Joerg Hau <joerg.hau@swissonline.ch> Subject: Re: Problem mit grep-Umleitung in shellscript Date: 2000/04/05 Message-ID: <954953650.263246375@localhost> X-Deja-AN: 607142619 Content-Transfer-Encoding: 8bit References: <954795685.1431006335@localhost> Followup-To: ch.comp.os.linux Content-Type: text/plain; charset="us-ascii" X-Complaints-To: usenet@dplanet.ch X-Trace: hs1b01h02-0.dplanet.ch 954953822 1509 212.35.61.123 (5 Apr 2000 16:57:02 GMT) Organization: I speak for myself Mime-Version: 1.0 NNTP-Posting-Date: 5 Apr 2000 16:57:02 GMT Newsgroups: ch.comp.os.linux