Unix/Linux Go Back    


UNIX for Dummies Questions & Answers This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in this forum UNIX for Beginners Questions & Answers

Date of file

UNIX for Dummies Questions & Answers


 
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 01-25-2013
Manueldo Manueldo is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 25 January 2013, 4:24 PM EST
Posts: 21
Thanks: 2
Thanked 0 Times in 0 Posts
Date of file

I need to check whether my file is up to date or no...Can you tell me command in shell which helps to do it??? With example please.
Sponsored Links
    #2  
Old Unix and Linux 01-25-2013
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 23 August 2016, 4:39 PM EDT
Location: Saskatchewan
Posts: 21,421
Thanks: 967
Thanked 3,895 Times in 3,624 Posts
What do you mean by 'up to date'? Modified today?
Sponsored Links
    #3  
Old Unix and Linux 01-25-2013
Manueldo Manueldo is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 25 January 2013, 4:24 PM EST
Posts: 21
Thanks: 2
Thanked 0 Times in 0 Posts
NEWER...with IF test ...I guess yes.....
    #4  
Old Unix and Linux 01-25-2013
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 23 August 2016, 4:39 PM EDT
Location: Saskatchewan
Posts: 21,421
Thanks: 967
Thanked 3,895 Times in 3,624 Posts
Newer than what?
Sponsored Links
    #5  
Old Unix and Linux 01-25-2013
Yoda's Unix or Linux Image
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 23 August 2016, 5:34 PM EDT
Location: Galactic Empire
Posts: 3,516
Thanks: 248
Thanked 1,272 Times in 1,194 Posts
Have a look at this page for the complete list of test-expression used with if

Code:
[[ -N filename ]] && echo yes || echo no

-N option - True if FILE exists and has been modified since it was last read. I guess this is what you are looking for!
Sponsored Links
    #6  
Old Unix and Linux 01-25-2013
Manueldo Manueldo is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 25 January 2013, 4:24 PM EST
Posts: 21
Thanks: 2
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by bipinajith View Post
Have a look at this page for the complete list of test-expression used with if

Code:
[[ -N filename ]] && echo yes || echo no

-N option - True if FILE exists and has been modified since it was last read. I guess this is what you are looking for!
#!/bin/sh
It does not work. It gives me only NO. $3 $4$5$6 my files
file=$1
target=$2
while read line
do
if [ "$line" != "" ]
then
set $line
if [ "$1" = "$target" ]
then
if [ "$2" = ":" ]
then
for i in $3 $4 $5 $6
do
-N i && echo yes || echo no
done
fi
fi
fi
done< $file

---------- Post updated at 01:19 PM ---------- Previous update was at 01:15 PM ----------

I found out whats wrong Linux thank you for helping Linux
Sponsored Links
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
finding date numeral from file and check the validity of date format manas_ranjan Shell Programming and Scripting 10 11-18-2011 02:58 PM
ksh compare dates INSIDE a file (ie date A is > date B) right_coaster Shell Programming and Scripting 4 10-13-2011 11:53 PM
Delete a row from a file if one column containing a date is greater than the current system date chumsky UNIX for Dummies Questions & Answers 4 07-06-2011 02:07 AM
finding the previous day date and creating a file with date apple2685 Shell Programming and Scripting 4 05-17-2011 05:21 AM
Move A File With Same Date,don't Change The Desitination Dir Date jee.ku2 UNIX for Dummies Questions & Answers 1 01-09-2008 12:42 PM



All times are GMT -4. The time now is 12:20 AM.