Find the age of the oldest file in one line or return zeroDetermining number of files in a directory without counting themCheck for subdirectoryAdd mtime to grep -c output and sort the output by mtimehow to find files of current date in remote server and copy those file to local server using rcp using shell scripting (ksh)?Search for files that contain a string and list their names sorted by the modified daterecursive search and print most recent tar.gz file in each dirFind and rm command deleted the files inside the directory and the directory itselfHow do I change the sorting method of files used by asterisk (*) in bash?Find files, print creation date and file namescp <source>:<filepath> <dest> works from command line, but cp: cannot stat error from script. Why?

Do airline pilots ever risk not hearing communication directed to them specifically, from traffic controllers?

Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?

The use of multiple foreign keys on same column in SQL Server

When blogging recipes, how can I support both readers who want the narrative/journey and ones who want the printer-friendly recipe?

Extreme, but not acceptable situation and I can't start the work tomorrow morning

Draw simple lines in Inkscape

Is there a minimum number of transactions in a block?

What is the offset in a seaplane's hull?

Should I join an office cleaning event for free?

My colleague's body is amazing

Why is this code 6.5x slower with optimizations enabled?

A newer friend of my brother's gave him a load of baseball cards that are supposedly extremely valuable. Is this a scam?

Non-Jewish family in an Orthodox Jewish Wedding

What is the command to reset a PC without deleting any files

Infinite past with a beginning?

How does one intimidate enemies without having the capacity for violence?

Simulate Bitwise Cyclic Tag

I see my dog run

Does the radius of the Spirit Guardians spell depend on the size of the caster?

How to make payment on the internet without leaving a money trail?

What Brexit solution does the DUP want?

Why do we use polarized capacitor?

Shell script can be run only with sh command

Can you lasso down a wizard who is using the Levitate spell?



Find the age of the oldest file in one line or return zero


Determining number of files in a directory without counting themCheck for subdirectoryAdd mtime to grep -c output and sort the output by mtimehow to find files of current date in remote server and copy those file to local server using rcp using shell scripting (ksh)?Search for files that contain a string and list their names sorted by the modified daterecursive search and print most recent tar.gz file in each dirFind and rm command deleted the files inside the directory and the directory itselfHow do I change the sorting method of files used by asterisk (*) in bash?Find files, print creation date and file namescp <source>:<filepath> <dest> works from command line, but cp: cannot stat error from script. Why?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








4















I want to find the age of the oldest file in a certain directory or return 0 if there aren't any files in this directory. I also need a one-line command doing it. So far this is my command for finding the age in seconds of the oldest file in the directory:



expr $(($(date +%s) - $(stat -c %Y $(ls -lt /path/to/dir/ | tail -1 | awk 'print $NF'))))


The problem is that if there are no files it is returning the following error:



$ expr $(($(date +%s) - $(stat -c %Y $(ls -lt /path/to/dir/ | tail -1 | awk 'print $NF'))))
stat: cannot stat ‘0’: No such file or directory
-bash: 1554373460 - : syntax error: operand expected (error token is "- ")


So in this case I want the command to return just 0 and to suppress the error printout.










share|improve this question

















  • 2





    Out of curiosity, why does it have to be in one line? It's much less readable & maintainable that way.

    – Jeff Schaller
    Apr 4 at 10:30











  • I am passing this line to specialized software. Then according to the output of the command, I can trigger an alarm and if I make it on more than a single line, I need to write more complex logic. The idea is to check a specific directory where there should not be any files for more than 20 seconds, I want to trigger an alarm if the age of the oldest file is more than 30 seconds.

    – Georgе Stoyanov
    Apr 4 at 10:39












  • also I would be very happy if you have any ideas, how I can simplify my command for finding the age of the oldest file

    – Georgе Stoyanov
    Apr 4 at 10:41











  • ls -lt | tail -1 will give you the oldest file; you can parse out the date or go through the stat stuff without having to do a single line shell loop

    – mpez0
    Apr 4 at 20:06












  • @mpez0 this is exactly what I am doing, check my original post.

    – Georgе Stoyanov
    2 days ago

















4















I want to find the age of the oldest file in a certain directory or return 0 if there aren't any files in this directory. I also need a one-line command doing it. So far this is my command for finding the age in seconds of the oldest file in the directory:



expr $(($(date +%s) - $(stat -c %Y $(ls -lt /path/to/dir/ | tail -1 | awk 'print $NF'))))


The problem is that if there are no files it is returning the following error:



$ expr $(($(date +%s) - $(stat -c %Y $(ls -lt /path/to/dir/ | tail -1 | awk 'print $NF'))))
stat: cannot stat ‘0’: No such file or directory
-bash: 1554373460 - : syntax error: operand expected (error token is "- ")


So in this case I want the command to return just 0 and to suppress the error printout.










share|improve this question

















  • 2





    Out of curiosity, why does it have to be in one line? It's much less readable & maintainable that way.

    – Jeff Schaller
    Apr 4 at 10:30











  • I am passing this line to specialized software. Then according to the output of the command, I can trigger an alarm and if I make it on more than a single line, I need to write more complex logic. The idea is to check a specific directory where there should not be any files for more than 20 seconds, I want to trigger an alarm if the age of the oldest file is more than 30 seconds.

    – Georgе Stoyanov
    Apr 4 at 10:39












  • also I would be very happy if you have any ideas, how I can simplify my command for finding the age of the oldest file

    – Georgе Stoyanov
    Apr 4 at 10:41











  • ls -lt | tail -1 will give you the oldest file; you can parse out the date or go through the stat stuff without having to do a single line shell loop

    – mpez0
    Apr 4 at 20:06












  • @mpez0 this is exactly what I am doing, check my original post.

    – Georgе Stoyanov
    2 days ago













4












4








4


1






I want to find the age of the oldest file in a certain directory or return 0 if there aren't any files in this directory. I also need a one-line command doing it. So far this is my command for finding the age in seconds of the oldest file in the directory:



expr $(($(date +%s) - $(stat -c %Y $(ls -lt /path/to/dir/ | tail -1 | awk 'print $NF'))))


The problem is that if there are no files it is returning the following error:



$ expr $(($(date +%s) - $(stat -c %Y $(ls -lt /path/to/dir/ | tail -1 | awk 'print $NF'))))
stat: cannot stat ‘0’: No such file or directory
-bash: 1554373460 - : syntax error: operand expected (error token is "- ")


So in this case I want the command to return just 0 and to suppress the error printout.










share|improve this question














I want to find the age of the oldest file in a certain directory or return 0 if there aren't any files in this directory. I also need a one-line command doing it. So far this is my command for finding the age in seconds of the oldest file in the directory:



expr $(($(date +%s) - $(stat -c %Y $(ls -lt /path/to/dir/ | tail -1 | awk 'print $NF'))))


The problem is that if there are no files it is returning the following error:



$ expr $(($(date +%s) - $(stat -c %Y $(ls -lt /path/to/dir/ | tail -1 | awk 'print $NF'))))
stat: cannot stat ‘0’: No such file or directory
-bash: 1554373460 - : syntax error: operand expected (error token is "- ")


So in this case I want the command to return just 0 and to suppress the error printout.







shell-script files directory






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 4 at 10:26









Georgе StoyanovGeorgе Stoyanov

164421




164421







  • 2





    Out of curiosity, why does it have to be in one line? It's much less readable & maintainable that way.

    – Jeff Schaller
    Apr 4 at 10:30











  • I am passing this line to specialized software. Then according to the output of the command, I can trigger an alarm and if I make it on more than a single line, I need to write more complex logic. The idea is to check a specific directory where there should not be any files for more than 20 seconds, I want to trigger an alarm if the age of the oldest file is more than 30 seconds.

    – Georgе Stoyanov
    Apr 4 at 10:39












  • also I would be very happy if you have any ideas, how I can simplify my command for finding the age of the oldest file

    – Georgе Stoyanov
    Apr 4 at 10:41











  • ls -lt | tail -1 will give you the oldest file; you can parse out the date or go through the stat stuff without having to do a single line shell loop

    – mpez0
    Apr 4 at 20:06












  • @mpez0 this is exactly what I am doing, check my original post.

    – Georgе Stoyanov
    2 days ago












  • 2





    Out of curiosity, why does it have to be in one line? It's much less readable & maintainable that way.

    – Jeff Schaller
    Apr 4 at 10:30











  • I am passing this line to specialized software. Then according to the output of the command, I can trigger an alarm and if I make it on more than a single line, I need to write more complex logic. The idea is to check a specific directory where there should not be any files for more than 20 seconds, I want to trigger an alarm if the age of the oldest file is more than 30 seconds.

    – Georgе Stoyanov
    Apr 4 at 10:39












  • also I would be very happy if you have any ideas, how I can simplify my command for finding the age of the oldest file

    – Georgе Stoyanov
    Apr 4 at 10:41











  • ls -lt | tail -1 will give you the oldest file; you can parse out the date or go through the stat stuff without having to do a single line shell loop

    – mpez0
    Apr 4 at 20:06












  • @mpez0 this is exactly what I am doing, check my original post.

    – Georgе Stoyanov
    2 days ago







2




2





Out of curiosity, why does it have to be in one line? It's much less readable & maintainable that way.

– Jeff Schaller
Apr 4 at 10:30





Out of curiosity, why does it have to be in one line? It's much less readable & maintainable that way.

– Jeff Schaller
Apr 4 at 10:30













I am passing this line to specialized software. Then according to the output of the command, I can trigger an alarm and if I make it on more than a single line, I need to write more complex logic. The idea is to check a specific directory where there should not be any files for more than 20 seconds, I want to trigger an alarm if the age of the oldest file is more than 30 seconds.

– Georgе Stoyanov
Apr 4 at 10:39






I am passing this line to specialized software. Then according to the output of the command, I can trigger an alarm and if I make it on more than a single line, I need to write more complex logic. The idea is to check a specific directory where there should not be any files for more than 20 seconds, I want to trigger an alarm if the age of the oldest file is more than 30 seconds.

– Georgе Stoyanov
Apr 4 at 10:39














also I would be very happy if you have any ideas, how I can simplify my command for finding the age of the oldest file

– Georgе Stoyanov
Apr 4 at 10:41





also I would be very happy if you have any ideas, how I can simplify my command for finding the age of the oldest file

– Georgе Stoyanov
Apr 4 at 10:41













ls -lt | tail -1 will give you the oldest file; you can parse out the date or go through the stat stuff without having to do a single line shell loop

– mpez0
Apr 4 at 20:06






ls -lt | tail -1 will give you the oldest file; you can parse out the date or go through the stat stuff without having to do a single line shell loop

– mpez0
Apr 4 at 20:06














@mpez0 this is exactly what I am doing, check my original post.

– Georgе Stoyanov
2 days ago





@mpez0 this is exactly what I am doing, check my original post.

– Georgе Stoyanov
2 days ago










2 Answers
2






active

oldest

votes


















4














If it must be one line:



stat -c %Y ./* 2>/dev/null | awk -v d="$(date +%s)" 'BEGIN m=d $0 < m m = $0 END print d - m'



  • stat -c %Y ./* 2>/dev/null print the timestamp of all files, ignoring errors (so no files results in no output)


  • With awk:




    • -v d="$(date +%s)" save the current timestamp in a variable d


    • BEGIN m=d initialize m to d


    • $0 < m m = $0 keeping track of the minimum in m


    • END print d - m print the difference.






share|improve this answer

























  • unfortunately, it does return 0 no matter if the directory is empty or it has more than one file

    – Georgе Stoyanov
    Apr 4 at 10:55











  • @George ah, oops, I inverted the check for min

    – muru
    Apr 4 at 11:03


















5














With zsh and perl:



perl -le 'print 0+-M $ARGV[0]' /path/to/dir/*(N-Om[1])


(add the D glob qualifier if you also want to consider hidden files (but not . nor ..)).



Note that for symlinks, that considers the modification time of the file it resolves to. Remove the - in the glob qualifiers to consider the modification time of the symlink instead (and use (lstat$ARGV[0] && -M _) in perl to get the age of the symlink).



That gives the age in days. Multiply by 86400 to get a number of seconds:



perl -le 'print 86400*-M $ARGV[0]' /path/to/dir/*(N-Om[1])



  • (N-Om[1]): glob qualifier:


    • N: turns on nullglob for that glob. So if there's no file in the directory, expands to nothing causing perl's -M to return undef.


    • -: causes next glob qualifiers to apply on the target of symlinks


    • Om: reverse (capital) order by modification time (so from oldest to newest like ls -rt)


    • [1]: select first matching file only



  • -M file: gets the age of the content of the file.


  • 0+ or 86400* force a conversion to number (for the undef case).





share|improve this answer

























  • I am getting just 0 as an output even though it should show me a couple of thousands of seconds, both commands actually gives me the same output and on another machine I am getting an error: -bash: syntax error near unexpected token '(', the one giving me an error is running a rather old version of perl: v5.16.3

    – Georgе Stoyanov
    Apr 4 at 14:39







  • 2





    @GeorgеStoyanov, the syntax is for zsh, not bash.

    – Stéphane Chazelas
    Apr 4 at 15:37











  • I missed that part :) Thanks for the answer @Stephane

    – Georgе Stoyanov
    2 days ago











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f510472%2ffind-the-age-of-the-oldest-file-in-one-line-or-return-zero%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














If it must be one line:



stat -c %Y ./* 2>/dev/null | awk -v d="$(date +%s)" 'BEGIN m=d $0 < m m = $0 END print d - m'



  • stat -c %Y ./* 2>/dev/null print the timestamp of all files, ignoring errors (so no files results in no output)


  • With awk:




    • -v d="$(date +%s)" save the current timestamp in a variable d


    • BEGIN m=d initialize m to d


    • $0 < m m = $0 keeping track of the minimum in m


    • END print d - m print the difference.






share|improve this answer

























  • unfortunately, it does return 0 no matter if the directory is empty or it has more than one file

    – Georgе Stoyanov
    Apr 4 at 10:55











  • @George ah, oops, I inverted the check for min

    – muru
    Apr 4 at 11:03















4














If it must be one line:



stat -c %Y ./* 2>/dev/null | awk -v d="$(date +%s)" 'BEGIN m=d $0 < m m = $0 END print d - m'



  • stat -c %Y ./* 2>/dev/null print the timestamp of all files, ignoring errors (so no files results in no output)


  • With awk:




    • -v d="$(date +%s)" save the current timestamp in a variable d


    • BEGIN m=d initialize m to d


    • $0 < m m = $0 keeping track of the minimum in m


    • END print d - m print the difference.






share|improve this answer

























  • unfortunately, it does return 0 no matter if the directory is empty or it has more than one file

    – Georgе Stoyanov
    Apr 4 at 10:55











  • @George ah, oops, I inverted the check for min

    – muru
    Apr 4 at 11:03













4












4








4







If it must be one line:



stat -c %Y ./* 2>/dev/null | awk -v d="$(date +%s)" 'BEGIN m=d $0 < m m = $0 END print d - m'



  • stat -c %Y ./* 2>/dev/null print the timestamp of all files, ignoring errors (so no files results in no output)


  • With awk:




    • -v d="$(date +%s)" save the current timestamp in a variable d


    • BEGIN m=d initialize m to d


    • $0 < m m = $0 keeping track of the minimum in m


    • END print d - m print the difference.






share|improve this answer















If it must be one line:



stat -c %Y ./* 2>/dev/null | awk -v d="$(date +%s)" 'BEGIN m=d $0 < m m = $0 END print d - m'



  • stat -c %Y ./* 2>/dev/null print the timestamp of all files, ignoring errors (so no files results in no output)


  • With awk:




    • -v d="$(date +%s)" save the current timestamp in a variable d


    • BEGIN m=d initialize m to d


    • $0 < m m = $0 keeping track of the minimum in m


    • END print d - m print the difference.







share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 4 at 12:19









Stéphane Chazelas

313k57593949




313k57593949










answered Apr 4 at 10:44









murumuru

37.2k589164




37.2k589164












  • unfortunately, it does return 0 no matter if the directory is empty or it has more than one file

    – Georgе Stoyanov
    Apr 4 at 10:55











  • @George ah, oops, I inverted the check for min

    – muru
    Apr 4 at 11:03

















  • unfortunately, it does return 0 no matter if the directory is empty or it has more than one file

    – Georgе Stoyanov
    Apr 4 at 10:55











  • @George ah, oops, I inverted the check for min

    – muru
    Apr 4 at 11:03
















unfortunately, it does return 0 no matter if the directory is empty or it has more than one file

– Georgе Stoyanov
Apr 4 at 10:55





unfortunately, it does return 0 no matter if the directory is empty or it has more than one file

– Georgе Stoyanov
Apr 4 at 10:55













@George ah, oops, I inverted the check for min

– muru
Apr 4 at 11:03





@George ah, oops, I inverted the check for min

– muru
Apr 4 at 11:03













5














With zsh and perl:



perl -le 'print 0+-M $ARGV[0]' /path/to/dir/*(N-Om[1])


(add the D glob qualifier if you also want to consider hidden files (but not . nor ..)).



Note that for symlinks, that considers the modification time of the file it resolves to. Remove the - in the glob qualifiers to consider the modification time of the symlink instead (and use (lstat$ARGV[0] && -M _) in perl to get the age of the symlink).



That gives the age in days. Multiply by 86400 to get a number of seconds:



perl -le 'print 86400*-M $ARGV[0]' /path/to/dir/*(N-Om[1])



  • (N-Om[1]): glob qualifier:


    • N: turns on nullglob for that glob. So if there's no file in the directory, expands to nothing causing perl's -M to return undef.


    • -: causes next glob qualifiers to apply on the target of symlinks


    • Om: reverse (capital) order by modification time (so from oldest to newest like ls -rt)


    • [1]: select first matching file only



  • -M file: gets the age of the content of the file.


  • 0+ or 86400* force a conversion to number (for the undef case).





share|improve this answer

























  • I am getting just 0 as an output even though it should show me a couple of thousands of seconds, both commands actually gives me the same output and on another machine I am getting an error: -bash: syntax error near unexpected token '(', the one giving me an error is running a rather old version of perl: v5.16.3

    – Georgе Stoyanov
    Apr 4 at 14:39







  • 2





    @GeorgеStoyanov, the syntax is for zsh, not bash.

    – Stéphane Chazelas
    Apr 4 at 15:37











  • I missed that part :) Thanks for the answer @Stephane

    – Georgе Stoyanov
    2 days ago















5














With zsh and perl:



perl -le 'print 0+-M $ARGV[0]' /path/to/dir/*(N-Om[1])


(add the D glob qualifier if you also want to consider hidden files (but not . nor ..)).



Note that for symlinks, that considers the modification time of the file it resolves to. Remove the - in the glob qualifiers to consider the modification time of the symlink instead (and use (lstat$ARGV[0] && -M _) in perl to get the age of the symlink).



That gives the age in days. Multiply by 86400 to get a number of seconds:



perl -le 'print 86400*-M $ARGV[0]' /path/to/dir/*(N-Om[1])



  • (N-Om[1]): glob qualifier:


    • N: turns on nullglob for that glob. So if there's no file in the directory, expands to nothing causing perl's -M to return undef.


    • -: causes next glob qualifiers to apply on the target of symlinks


    • Om: reverse (capital) order by modification time (so from oldest to newest like ls -rt)


    • [1]: select first matching file only



  • -M file: gets the age of the content of the file.


  • 0+ or 86400* force a conversion to number (for the undef case).





share|improve this answer

























  • I am getting just 0 as an output even though it should show me a couple of thousands of seconds, both commands actually gives me the same output and on another machine I am getting an error: -bash: syntax error near unexpected token '(', the one giving me an error is running a rather old version of perl: v5.16.3

    – Georgе Stoyanov
    Apr 4 at 14:39







  • 2





    @GeorgеStoyanov, the syntax is for zsh, not bash.

    – Stéphane Chazelas
    Apr 4 at 15:37











  • I missed that part :) Thanks for the answer @Stephane

    – Georgе Stoyanov
    2 days ago













5












5








5







With zsh and perl:



perl -le 'print 0+-M $ARGV[0]' /path/to/dir/*(N-Om[1])


(add the D glob qualifier if you also want to consider hidden files (but not . nor ..)).



Note that for symlinks, that considers the modification time of the file it resolves to. Remove the - in the glob qualifiers to consider the modification time of the symlink instead (and use (lstat$ARGV[0] && -M _) in perl to get the age of the symlink).



That gives the age in days. Multiply by 86400 to get a number of seconds:



perl -le 'print 86400*-M $ARGV[0]' /path/to/dir/*(N-Om[1])



  • (N-Om[1]): glob qualifier:


    • N: turns on nullglob for that glob. So if there's no file in the directory, expands to nothing causing perl's -M to return undef.


    • -: causes next glob qualifiers to apply on the target of symlinks


    • Om: reverse (capital) order by modification time (so from oldest to newest like ls -rt)


    • [1]: select first matching file only



  • -M file: gets the age of the content of the file.


  • 0+ or 86400* force a conversion to number (for the undef case).





share|improve this answer















With zsh and perl:



perl -le 'print 0+-M $ARGV[0]' /path/to/dir/*(N-Om[1])


(add the D glob qualifier if you also want to consider hidden files (but not . nor ..)).



Note that for symlinks, that considers the modification time of the file it resolves to. Remove the - in the glob qualifiers to consider the modification time of the symlink instead (and use (lstat$ARGV[0] && -M _) in perl to get the age of the symlink).



That gives the age in days. Multiply by 86400 to get a number of seconds:



perl -le 'print 86400*-M $ARGV[0]' /path/to/dir/*(N-Om[1])



  • (N-Om[1]): glob qualifier:


    • N: turns on nullglob for that glob. So if there's no file in the directory, expands to nothing causing perl's -M to return undef.


    • -: causes next glob qualifiers to apply on the target of symlinks


    • Om: reverse (capital) order by modification time (so from oldest to newest like ls -rt)


    • [1]: select first matching file only



  • -M file: gets the age of the content of the file.


  • 0+ or 86400* force a conversion to number (for the undef case).






share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 4 at 15:38

























answered Apr 4 at 12:18









Stéphane ChazelasStéphane Chazelas

313k57593949




313k57593949












  • I am getting just 0 as an output even though it should show me a couple of thousands of seconds, both commands actually gives me the same output and on another machine I am getting an error: -bash: syntax error near unexpected token '(', the one giving me an error is running a rather old version of perl: v5.16.3

    – Georgе Stoyanov
    Apr 4 at 14:39







  • 2





    @GeorgеStoyanov, the syntax is for zsh, not bash.

    – Stéphane Chazelas
    Apr 4 at 15:37











  • I missed that part :) Thanks for the answer @Stephane

    – Georgе Stoyanov
    2 days ago

















  • I am getting just 0 as an output even though it should show me a couple of thousands of seconds, both commands actually gives me the same output and on another machine I am getting an error: -bash: syntax error near unexpected token '(', the one giving me an error is running a rather old version of perl: v5.16.3

    – Georgе Stoyanov
    Apr 4 at 14:39







  • 2





    @GeorgеStoyanov, the syntax is for zsh, not bash.

    – Stéphane Chazelas
    Apr 4 at 15:37











  • I missed that part :) Thanks for the answer @Stephane

    – Georgе Stoyanov
    2 days ago
















I am getting just 0 as an output even though it should show me a couple of thousands of seconds, both commands actually gives me the same output and on another machine I am getting an error: -bash: syntax error near unexpected token '(', the one giving me an error is running a rather old version of perl: v5.16.3

– Georgе Stoyanov
Apr 4 at 14:39






I am getting just 0 as an output even though it should show me a couple of thousands of seconds, both commands actually gives me the same output and on another machine I am getting an error: -bash: syntax error near unexpected token '(', the one giving me an error is running a rather old version of perl: v5.16.3

– Georgе Stoyanov
Apr 4 at 14:39





2




2





@GeorgеStoyanov, the syntax is for zsh, not bash.

– Stéphane Chazelas
Apr 4 at 15:37





@GeorgеStoyanov, the syntax is for zsh, not bash.

– Stéphane Chazelas
Apr 4 at 15:37













I missed that part :) Thanks for the answer @Stephane

– Georgе Stoyanov
2 days ago





I missed that part :) Thanks for the answer @Stephane

– Georgе Stoyanov
2 days ago

















draft saved

draft discarded
















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f510472%2ffind-the-age-of-the-oldest-file-in-one-line-or-return-zero%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070

Cegueira Índice Epidemioloxía | Deficiencia visual | Tipos de cegueira | Principais causas de cegueira | Tratamento | Técnicas de adaptación e axudas | Vida dos cegos | Primeiros auxilios | Crenzas respecto das persoas cegas | Crenzas das persoas cegas | O neno deficiente visual | Aspectos psicolóxicos da cegueira | Notas | Véxase tamén | Menú de navegación54.054.154.436928256blindnessDicionario da Real Academia GalegaPortal das Palabras"International Standards: Visual Standards — Aspects and Ranges of Vision Loss with Emphasis on Population Surveys.""Visual impairment and blindness""Presentan un plan para previr a cegueira"o orixinalACCDV Associació Catalana de Cecs i Disminuïts Visuals - PMFTrachoma"Effect of gene therapy on visual function in Leber's congenital amaurosis"1844137110.1056/NEJMoa0802268Cans guía - os mellores amigos dos cegosArquivadoEscola de cans guía para cegos en Mortágua, PortugalArquivado"Tecnología para ciegos y deficientes visuales. Recopilación de recursos gratuitos en la Red""Colorino""‘COL.diesis’, escuchar los sonidos del color""COL.diesis: Transforming Colour into Melody and Implementing the Result in a Colour Sensor Device"o orixinal"Sistema de desarrollo de sinestesia color-sonido para invidentes utilizando un protocolo de audio""Enseñanza táctil - geometría y color. Juegos didácticos para niños ciegos y videntes""Sistema Constanz"L'ocupació laboral dels cecs a l'Estat espanyol està pràcticament equiparada a la de les persones amb visió, entrevista amb Pedro ZuritaONCE (Organización Nacional de Cegos de España)Prevención da cegueiraDescrición de deficiencias visuais (Disc@pnet)Braillín, un boneco atractivo para calquera neno, con ou sen discapacidade, que permite familiarizarse co sistema de escritura e lectura brailleAxudas Técnicas36838ID00897494007150-90057129528256DOID:1432HP:0000618D001766C10.597.751.941.162C97109C0155020