[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] Tilde expansion not carried out in file_cmd
From: |
Pavel Kačer |
Subject: |
Re: [Bug-wget] Tilde expansion not carried out in file_cmd |
Date: |
Thu, 14 Mar 2013 22:08:40 +0100 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On Fri, 15 Mar 2013 00:45:38 +0530
Darshit Shah <address@hidden> wrote:
> In fact I wrote this to specifically expand command line options,
> since bash did not expand the tilde in the filename I gave
> through the command line.
> Here is the output I got.
>
> $ wget --post-file=~/vimrc www.example.com
> > --2013-03-15 00:31:54-- http://www.example.com/
> > POST data file ‘~/vimrc’ missing: No such file or directory
> >
>
> In case you say, that the shell should have handled this, I guess
> it's an issue with bash, and I must work upstream to resolve it.
The Bash works correctly in this case. Please have a look at Texinfo
documentation for the Bash. Bash separates (command line) input into
`words'. In this case the `words' are separated by IFS Bourne shell
variable.
CITE
`word'
A sequence of characters treated as a unit by the shell. Words
may not include unquoted `metacharacters'.
...
If a word begins with an unquoted tilde character (`~'), all of the
characters up to the first unquoted slash (or all characters, if there
is no unquoted slash) are considered a TILDE-PREFIX.
EOCITE
In other words you need to have a character in the IFS variable
*before* the tilde character. IFS by default means whitespace
characters and a newline. Usually like the following.
IFS=' \t\n'
To do what you want just write
$ wget --post-file ~/vimrc www.example.com
or
$ wget --post-file "~/vimrc" www.example.com
- --
S pozdravem / Kind regards
Pavel Kačer
Join us and use free software.
http://www.fsf.org/
I am FSF member decimal number 10000 (0x2710).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
iF4EAREIAAYFAlFCPFgACgkQbXIOSC+VLYPupwEA3PeFHgpLzMSdWtKvLIzf8E35
QqlxY6kfIucTkRsggi8BANhEvFhnhBl3N9z6hBLhsAuhS/o7Z6aoaJ0xrKjSCnVc
=g2UD
-----END PGP SIGNATURE-----