RE: uploading a file
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.
-mn
From: curl-users <curl-users-bounces_at_cool.haxx.se> On Behalf Of mehran j via curl-users
Sent: September 29, 2020 3:23 AM
To: Paul Gilmartin via curl-users <curl-users_at_cool.haxx.se>
Cc: mehran j <mehran_j123_at_yahoo.co.uk>
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.
Thanks,
Mehran
On Friday, 25 September 2020, 17:41:48 BST, Paul Gilmartin via curl-users <curl-users_at_cool.haxx.se<mailto:curl-users_at_cool.haxx.se>> wrote:
On 2020-09-25, at 07:58:55, mehran j via curl-users <curl-users_at_cool.haxx.se<mailto:curl-users_at_cool.haxx.se>> 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?)
date
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
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-09-29