Unix/Linux Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Date of file

UNIX for Dummies Questions & Answers


Closed Linux or Unix Question    
 
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: 24 July 2015, 8:59 PM EDT
Location: Saskatchewan
Posts: 20,771
Thanks: 901
Thanked 3,704 Times in 3,460 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: 24 July 2015, 8:59 PM EDT
Location: Saskatchewan
Posts: 20,771
Thanks: 901
Thanked 3,704 Times in 3,460 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: 27 July 2015, 4:48 PM EDT
Location: Galactic Empire
Posts: 3,419
Thanks: 240
Thanked 1,222 Times in 1,148 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
Closed Linux or Unix Question

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 06:22 AM.