jc1992
jc1992

Reputation: 644

How to add date at name of file txt

I am using curl to get an information of eurobasket2017 this works correct but I launch this curl everyday with a cron.

curl -o dailyGameCode http://live.fibaeurope.com/www/KeyFacts.ashx?acc=0&lng=en&full=1

How can I pass the following format to a name of the file ?

date +%d-%m-%y

Regards !

Upvotes: 0

Views: 28

Answers (1)

nu11p01n73R
nu11p01n73R

Reputation: 26667

You can do shell substitution to get the date and then append it to the file name.

Example

$ today=$(date +%d-%m-%y)
$ curl -o "dailyGameCode-$today" http://live.fibaeurope.com/www/KeyFacts.ashx?acc=0&lng=en&full=1
$ ls
dailyGameCode-01-09-17

Upvotes: 3

Related Questions