Re: Bash: How do I quote CR &| LF in a command?
From: Guy Waugh (guywaugh_at_hotmail.com)
Date: 08/05/04
- Next message: Gerald Jones: "variable slicing in zsh?"
- Previous message: Alan Connor: "Re: Generate mail from Bourne shell"
- In reply to: foo: "Re: Bash: How do I quote CR &| LF in a command?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 4 Aug 2004 18:44:07 -0700
foo <foo@bar.baz> wrote in message news:<4e8Qc.87546$eM2.66256@attbi_s51>...
> Guy Waugh wrote:
>
> > Hi there,
> >
> > I want to use elinks (a text mode web browser) on a RHEL3 box to
> > access a URL on another server, but I want also to set a 'Host:'
> > header. Apparently this can be done, a la this perl script from
> > http://downloads.securityfocus.com:
> >
> > #!/usr/bin/perl --
> > # Ulf Harnhammar 2002
> > # example: ./exploit www.site1.st www.site2.st
> > # will show www.site2.st
> >
> > die "$0 hostone hosttwo\n" if @ARGV != 2;
> >
> > exec('lynx "'.
> > "http://$ARGV[0]/ HTTP/1.0\012".
> > "Host: $ARGV[1]\012\012".
> > '"');
> >
> > I haven't tested the above perl script - I'm assuming it works. As can
> > be seen, the URL part ('http://...') and the 'Host:' header are
> > separated by a carriage return character (\012).
> >
> > I want to do in bash what the above perl script does. However, I can't
> > figure out how to quote the carriage return so that it is passed
> > through to the web server in the same way that the perl script above
> > does it.
>
> ARGV=( ... )
> cr=$'\012' # see <http://www.tldp.org/LDP/abs/html/quoting.html>
>
> lynx "http://${ARGV[0]}/ HTTP/1.0${cr}Host: ${ARGV[1]}${cr}${cr}"
Thanks foo, that looks like it would work, but alas, I tested the perl
script this morning (should have done that yesterday), and it didn't
work...
I've decided to use wget to do this job, as you can give it an
argument of --header='' on the command line, which works perfectly.
Thanks for your reply too Stephane - I need the Host: header because
I'm working with LVS real servers inside the realserver network, so I
need to set the Host: header manually.
Cheers,
Guy.
- Next message: Gerald Jones: "variable slicing in zsh?"
- Previous message: Alan Connor: "Re: Generate mail from Bourne shell"
- In reply to: foo: "Re: Bash: How do I quote CR &| LF in a command?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|