Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Get current date in bash
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
grj
Tux's lil' helper
Tux's lil' helper


Joined: 15 Jun 2002
Posts: 96

PostPosted: Fri Aug 02, 2002 12:54 am    Post subject: Get current date in bash Reply with quote

Is there a way to get the current date in bash?
Then is it possible to format it as yyyy-mm-dd?

Thanks,
_________________
Hope this helps!

GRJ
Back to top
View user's profile Send private message
gfunkmonk
Tux's lil' helper
Tux's lil' helper


Joined: 10 Jul 2002
Posts: 129
Location: Freelandville, IN

PostPosted: Fri Aug 02, 2002 4:48 am    Post subject: Reply with quote

Have a look at this:
http://www.linuxbrit.co.uk/bashprompt/
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20067

PostPosted: Fri Aug 02, 2002 5:08 am    Post subject: Reply with quote

Or use Gentoo's own help here.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
ledents
n00b
n00b


Joined: 15 Jul 2002
Posts: 7

PostPosted: Fri Aug 02, 2002 6:51 am    Post subject: Reply with quote

just use de date command:
Code:
    DATE=`date +"%Y-%m-%d"`
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20067

PostPosted: Fri Aug 02, 2002 4:17 pm    Post subject: Reply with quote

ledents, well read. For some reason gfunkmonk and I seemed to think he wanted the date in his prompt.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
grj
Tux's lil' helper
Tux's lil' helper


Joined: 15 Jun 2002
Posts: 96

PostPosted: Sat Aug 03, 2002 12:35 am    Post subject: Reply with quote

Thanks for the help. I got my script working to download my pictures from my Kodak DC290 using gphoto command line arguments. The scripts checks to see if
~/camera/images/yyyy-mm-dd exists. It it does not the directory is created. After the directory is found to exist or is created the image download to it.

One note: to get the 4 digit year use %Y instead of %y which returns a w digit year.

Thanks,
_________________
Hope this helps!

GRJ
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum