Solved

Generate  a filename that include date and time

Posted on 2013-11-13
7
457 Views
Last Modified: 2013-11-13
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
0
Comment
Question by:lnrivera
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 39644043
import capture$(date +%Y-%m-%d-%H%M).png
0
 

Author Comment

by:lnrivera
ID: 39644111
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
 
LVL 84

Expert Comment

by:ozo
ID: 39644118
Which shell are you using?
If it doesn't understand $(date +%Y-%m-%d-%H%M), try `date +%Y-%m-%d-%H%M`
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:lnrivera
ID: 39644124
The standard for Ubuntu, I think that is bash.

The other option is including the character ' ?
0
 
LVL 84

Expert Comment

by:ozo
ID: 39644150
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
 
LVL 48

Expert Comment

by:Tintin
ID: 39644328
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
 

Author Closing Comment

by:lnrivera
ID: 39644376
Sorry, now works fine, I think tha we had a typing mistake
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
CentOS 7 Linux for HP DL380 G4 32Bits 7 104
how to include conditional log rotate in liunx. 17 103
swp file in unix 16 46
Require Script-Linux 4 12
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question