Re: how to use variables to build pipes?
From: aryzhov (aryzhov_at_my-deja.com)
Date: 11/29/04
- Next message: rakesh sharma: "Re: how to use variables to build pipes?"
- Previous message: Chris F.A. Johnson: "Re: how to use variables to build pipes?"
- In reply to: Claus Atzenbeck: "how to use variables to build pipes?"
- Next in thread: rakesh sharma: "Re: how to use variables to build pipes?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Nov 2004 00:16:17 -0800
Claus Atzenbeck <claus.atzenbeck@freenet.de> wrote in message news:<coe1qh$jmn$1@ngspool-d02.news.aol.com>...
> Hello,
>
> I have a bash shell script, but I don't come along well:
>
> ************************
> OUTPUTFILE="$HOME/Library/Logs/mx"
> OUTPUT="sed 's/something/nothing/g' | tee -a $OUTFILE"
>
> echo "something" | $OUTPUT
> cat blah.txt | $OUTPUT
> ...
> ************************
>
> Writing
> echo "something" | "$OUTPUT"
> does not help either.
>
> Where is the bug?
>
It's not the bug, it's how most shells work.
Try to use eval:
#!/bin/sh
#
#
# OUTPUT="sort | uniq -c"
# INPUT="
> aaa
> bbb
> bbb
> ccc
> aaa
> aaa
> ccc
> "
#
#
# echo "$INPUT" | sort | uniq -c
2
3 aaa
2 bbb
2 ccc
#
#
#
# echo "$INPUT" | eval "$OUTPUT"
2
3 aaa
2 bbb
2 ccc
#
#
- Next message: rakesh sharma: "Re: how to use variables to build pipes?"
- Previous message: Chris F.A. Johnson: "Re: how to use variables to build pipes?"
- In reply to: Claus Atzenbeck: "how to use variables to build pipes?"
- Next in thread: rakesh sharma: "Re: how to use variables to build pipes?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|