LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-08-2009, 04:45 AM   #1
miros84
Member
 
Registered: Aug 2009
Location: Spain
Distribution: Debian stable, squeeze
Posts: 501

Rep: Reputation: 31
Cannot use funccion $date in home network


Hello
I have a home network. I cannot use the funccion $date. WHen I use it in my PC, it works good, but when I use it to rename folder depende on the $(date) I got bash errors. I think, that is because $(date) create long names with spaces like:

Code:
lun sep  7 14:48:30 CEST 2009
So, there is some problem to create this names in network, that is what I think.

When I use $RANDOM instead $(date) it works good.

Any solution to can use $(date) in network?
 
Old 09-08-2009, 04:56 AM   #2
xeleema
Member
 
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 988
Blog Entries: 4

Rep: Reputation: 254Reputation: 254Reputation: 254
Variables or Command Substitution

Greetingz!

I'm a little lost....are you attempting to access the value stored in a Variable, or are you trying to do "Command Substitution" within a shell script?

Specifically, $(date) is not a function, you're calling the "date" command (as in /usr/bin/date), because you're using parenthesis, rather than curly brackets.

Unless you meant ${date} which would call a Variable, which should be set in the script, or your shell's environment files.

If you're trying to get a date added on to the end of a directory's name, you might want to check the manual page ("man date") for the syntax.

Perhaps something like this;

mv directory_name directory_name-`date +%Y_%m_%d-%H%M`

so you wind up with a directory named like this;

directory_name-2009_09_08-0253

Hope this helps!

Last edited by xeleema; 09-08-2009 at 04:57 AM. Reason: Fixed formatting of "date"
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting all files of home folder modified after a specific date for backup fc6_user Linux - General 2 03-30-2007 02:24 AM
Home movie date in subtitles iab941 Linux - Software 0 01-17-2005 04:07 AM
tar problem "Cannor utime: Operation not Permitted' l32 Linux - Newbie 1 06-28-2004 05:18 PM
Cannor reboot my system (Mandrake 10.0) zarazek Mandriva 3 06-17-2004 05:51 AM
Newbie wanna setup up a linux network on existing home network... marvc Linux - Networking 3 03-19-2003 09:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration