I/O redirect question

I/O redirect question

Post by seto » Sat, 14 Jun 1997 04:00:00



Dear Net Reader,
I have a question, which I hope is not too irritatingly simple.  I have
in a script right now:

command | tee temp_file
if [ "`grep search_word temp_file`" ]
then
  commands
fi
rm temp_file

I use a tee, so that the results of command also go to stdout.  Can you
please tell me what is an easier way, using file descriptor redirect.
All help is sincerely appreciated, preferably by E-mail.
Thanks,

 
 
 

I/O redirect question

Post by Andrew Dunst » Sun, 15 Jun 1997 04:00:00



crazy enough to say:

Quote:

>Dear Net Reader,
>I have a question, which I hope is not too irritatingly simple.  I have
>in a script right now:

>command | tee temp_file
>if [ "`grep search_word temp_file`" ]
>then
>  commands
>fi
>rm temp_file

>I use a tee, so that the results of command also go to stdout.  Can you
>please tell me what is an easier way, using file descriptor redirect.
>All help is sincerely appreciated, preferably by E-mail.

I don't see what is hard about this, nor what would be easier about using
some sort of redirection or pipe. but the if test is probably not what you
want to use. try something like:

if egrep -s search_word tempfile
then
  commands
fi

cheers

andrew
--
-------------------------------------------------------------------------
  There's nothing either good or bad, but thinking makes it so - Hamlet
  http://www.gr-lakes.com/~andrew (including PGP key)
  PGP Key fingerprint = 5C 44 7D E4 76 A3 31 DE  3D 11 FA 15 4D 87 1F 5E
-------------------------------------------------------------------------

 
 
 

I/O redirect question

Post by Herve Couppe de Lahongrais - CD » Tue, 17 Jun 1997 04:00:00



> Dear Net Reader,
> I have a question, which I hope is not too irritatingly simple.  I have
> in a script right now:

> command | tee temp_file
> if [ "`grep search_word temp_file`" ]
> then
>   commands
> fi
> rm temp_file

> I use a tee, so that the results of command also go to stdout.  Can you
> please tell me what is an easier way, using file descriptor redirect.
> All help is sincerely appreciated, preferably by E-mail.

There is no easier way : the command tee is the only way to redirect
standard output *both* to standard output and to a file.
There is no trick here using file descriptor. The command performs two
write operations, one to stdout, one to the file.

> Thanks,


--
Herve Couppe de Lahongrais (SEU)       | Eurocontrol Experimental Centre

 
 
 

1. Apache Redirect/ReWrite for redirecting old->new domains?

Hello:

I'm having some difficulty getting Apache to redirect page requests with
an informative message.  My place of employment is moving from their old
domain name to a new one.  We now have both of these domain names active,
both of which point to the same server.  Although we will be phasing out
the old address very soon, people continue accessing the pages at the old
address, hence the reason for the redirect.

Putting something like <META HTTP-EQUIV="refresh"
"CONTENT=05;URL=http://newdomain.com/newpage"> in all our pages is not
an optimal solution because (a) there are hundreds of pages that would
need to be updated, (b) this solution doesn't display an informative
message before the redirect, and (c) Apache provides a better solution.

I've tried using a RedirectMatch:

RedirectMatch http://olddomain.com/~test/(.*) http://newdomain.com/~test/$1

Unfortunately, any pages access in .../~test do not redirect, but access
from the olddomain.com.

I've also tried a RewriteRule:

RewriteRule http://olddomain.com/~test/.* http://newdomain.com/~test/$1 [R=301L]

This also doesn't seem to work.

Is there a way to redirect visitors to all pages (or some pages in a
given directory or directories) with an informative message that appears
for about 5 seconds from the old access point to the new one?  (Notice I
say "access point" instead of "old page to new page" -- since the pages
are the _same_ as the old and new addresses point to the same server)

Thanks in advance for any assistance.

--------------< LINUX: The choice of a GNU generation. >--------------

2. Console app to display stats

3. redirect sound card redirected to /dev/null

4. ITK Columbus Card 3.0 ISDN adapter on Linux

5. .redirect not redirecting to some places

6. cmdtool -C, xconsole: redirection doesn't work

7. : Weird ">" redirect behavior vs. ">>" redirect behavior

8. Process Accounting

9. Port Redirect works but doesn't redirect internal traffic

10. Apache newbie- question on redirect

11. Fork/redirect/pipe question (checked faq)

12. Question: Redirecting mail file

13. redirecting output question