filename with HASH

Dave Korn dave.korn.cygwin@gmail.com
Thu Nov 17 09:57:00 GMT 2011


On 17/11/2011 00:29, pen wrote:
> Few more tests: seems lynx dont like #
> 
> $ mv "test bay#, wwid" "test # abc"
> $ lynx -dump "test # abc"
> 
> Can't Access `file://localhost/cygdrive/e/test%20#%20abc'
> Alert!: Unable to access document.
> 
> lynx: Can't access startfile
> 
> $ mv  "test # abc" "test# a"
> $ lynx -dump "test# a"
> 
> Looking up test
> Making HTTP connection to test
> Alert!: Unable to connect to remote host.  <<
> 
> lynx: Can't access startfile http://test/#%20a

  A "#" marks a separator in a URL between the URI part and the anchor within
the page to load up the display at.  I think lynx is applying the same syntax
to local file URLs; for example, if you have a local file "index.html", you
can append any arbitrary # anchor to it:

> $ wget 'http://www.bbc.co.uk/'
> --2011-11-17 09:47:02--  http://www.bbc.co.uk/
> Resolving www.bbc.co.uk (www.bbc.co.uk)... 212.58.246.94
> Connecting to www.bbc.co.uk (www.bbc.co.uk)|212.58.246.94|:80... connected.
> HTTP request sent, awaiting response... 200 OK
> Length: 135886 (133K) [text/html]
> Saving to: `index.html'
> 
> 100%[======================================>] 135,886      446K/s   in 0.3s
> 
> 2011-11-17 09:47:03 (446 KB/s) - `index.html' saved [135886/135886]
> 
> 
> $ ls index*
> index.html
> 
> $ lynx -dump "index.html#foobar"
> 
>    #[1]A to Z [2]BBC Help [3]Terms of Use
> 
>    [4]British Broadcasting Corporation BBC Home
               [ ... snip ... ]

  So I think it's a limitation of the URL format that it's ambiguous between a
filename with an actual # in it and a filename followed by "#" and an anchor,
and there's probably not much lynx can do about it.  Your best bet, if you
absolutely have to use lynx on files with hash signs in their names, would be
to use lynx's -stdin option and redirect the input from the file, so that lynx
doesn't ever see the filename at all:

> $ lynx -dump "index.html # abc"
> 
> Can't Access `file://localhost/tmp/lynx/index.html%20#%20abc'
> Alert!: Unable to access document.
> 
> lynx: Can't access startfile
> 
> $ lynx -stdin -dump < "index.html # abc"
> 
>    #[1]A to Z [2]BBC Help [3]Terms of Use
> 
>    [4]British Broadcasting Corporation BBC Home
               [ ... snip ... ]


    cheers,
      DaveK


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list