LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices

Old

'stat' vs 'date' w/re string manipulation in Bash scripts

Posted 11-17-2011 at 05:31 PM by SilversleevesX
Updated 11-17-2011 at 05:42 PM by SilversleevesX

I started browsing the Web tonight looking to do something I had been doing in my Bash scripts with stat and three more lines of string cutting in one line instead.

I had been using stat -c &y file to get a file's modification date in scripts, but I have never liked the nine-digit "blink-of-an-eye" part of the return on that command. My method up till now has been to eliminate it with lines like these:
Code:
gdate=$(stat -c %y foo.jpg)
pqdate=$(echo ${gdate%.*})
...
Member
Posted in Discussion
Views 371 Comments 0 SilversleevesX is offline
Old

Same advice produces the same results

Posted 08-19-2010 at 08:41 PM by SilversleevesX

http://www.linuxquestions.org/questi...7/#post4071846

Read the first reply, then read here:

If the definition of insanity is doing the same thing twice (or more times) and expecting different results, then the question becomes: "Who's the more insane? The person who follows the advice, knowing in advance it probably won't make any difference or work out the way they want it to, or the person who, after...
Member
Posted in Discussion
Views 621 Comments 1 SilversleevesX is offline
Old

Same advice produces the same results

Posted 08-19-2010 at 08:41 PM by SilversleevesX

http://www.linuxquestions.org/questi...7/#post4071846

Read the first reply, then read here:

If the definition of insanity is doing the same thing twice (or more times) and expecting different results, then the question becomes: "Who's the more insane? The person who follows the advice, knowing in advance it probably won't make any difference or work out the way they want it to, or the person who, after...
Member
Posted in Uncategorized
Views 383 Comments 0 SilversleevesX is offline
Old

XRef to new thread on unix.com.

Posted 08-01-2010 at 07:27 PM by SilversleevesX
Updated 08-01-2010 at 07:30 PM by SilversleevesX

http://www.unix.com/shell-programmin...e-problem.html
Member
Posted in Discussion
Views 464 Comments 0 SilversleevesX is offline
Old

Don't ask -- it's here

Posted 07-25-2010 at 09:16 AM by SilversleevesX

Member
Views 618 Comments 1 SilversleevesX is offline

  



All times are GMT -5. The time now is 10:42 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration