Generate a filename that include date and time

Hi,

I'm using in Ubuntu the command "import capture.png" to save a screen capture to the file capture.png, but I need that every time that I run this command, the filename will be updated include the date and time , for example:

capture2013-11-14-2200.png or something like this

I try to with the command "import capture$date(%Y-%m%d)" but doesn't work.

Could you give me the command to dynamic generate the filename including datetime stamp?

Thanks in advance
lnriveraAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
ozoConnect With a Mentor Commented:
import capture$(date +%Y-%m-%d-%H%M).png
0
 
lnriveraAuthor Commented:
Thanks, but your command generate a file named "capture$(date +%Y-%m-%d-%H%M).png"

I see that between date and + there are a space, I try with and without space with the same results

I'm using Ubuntu 10.04 LTS

Regards
0
 
ozoCommented:
Which shell are you using?
If it doesn't understand $(date +%Y-%m-%d-%H%M), try `date +%Y-%m-%d-%H%M`
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
lnriveraAuthor Commented:
The standard for Ubuntu, I think that is bash.

The other option is including the character ' ?
0
 
ozoCommented:
bash understands $(), what was the exact command you used?
Where do you want to include the character ' ?
You can include it literally by enclosing it in "'", otherwise $() and `` would both be disabled inside ''
0
 
TintinCommented:
import capture$(date +%Y-%m-%d-%H%M).png

won't produce a file called

capture$(date +%Y-%m-%d-%H%M).png

Can you please copy/paste the exact command you are running.
0
 
lnriveraAuthor Commented:
Sorry, now works fine, I think tha we had a typing mistake
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.