curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

RE: uploading a file

From: Norton, Mike via curl-users <>
Date: Tue, 29 Sep 2020 14:59:10 +0000

Mehran, Paul already told you: use proper double-quotes not single-quotes.

When you use single-quotes you are telling your shell that you want it to use the exact literal contents of the quotes, that you don’t want your shell to expand the variable contents.

Since it sounds like you do want your shell to expand the variable $a then you should not be using single-quotes.


From: curl-users <> On Behalf Of mehran j via curl-users
Sent: September 29, 2020 3:23 AM
To: Paul Gilmartin via curl-users <>
Cc: mehran j <>
Subject: Re: uploading a file

Thanks for your reply,

It should upload a csv file with date stamp onto WebDev cloud directory.
the date adding part to the file works fine. however, it seems CURL have problem uploading test_$a.csv file. if I give the file test_20200929.csv name CURL command upload the file without any problem onto destination.


On Friday, 25 September 2020, 17:41:48 BST, Paul Gilmartin via curl-users <<>> wrote:

On 2020-09-25, at 07:58:55, mehran j via curl-users <<>> wrote:
> In a shell scrip.
> date
> a=`date '+%y%m%d'`;export a
> 2. Then script that runs creates the new test.csv file
> 3. mv /directory/test.csv /directory/test_$a.csv
> 4. curl --user user:password -T '/user/directory1/test_$a.csv' 'https://webcloud/directory1/directory2/'
> 5. mv yesterday's test_date.csv file onto processed directory.
> The CURL bit is not working unless it like curl --user user:password -T '/user/directory1/test_20200925.csv' 'https://webcloud/directory1/directory2/'
> ie: exact name for the csv file like test_20200925.csv rather than test_$a.csv
I'll revise my suggestion:

set -x # Keep a log (but where does it go?)
a=`date '+%y%m%d'`;export a # looks good.

# Then use quotation marks instead of apostrophes:

    curl --user user:password -T "/user/directory1/test_$a.csv" 'https://webcloud/directory1/directory2/'

-- gil


Received on 2020-09-29