Search Results

Search: Posts Made By: coderanger
4,465
Posted By coderanger
OK found the problem. Problem was the ls command...
OK found the problem. Problem was the ls command used in the command line was of a different format then the ls command used within the bash script. So when I compared the data at the command line I...
4,465
Posted By coderanger
Yes but I would still like to know why this is...
Yes but I would still like to know why this is not working as it should. The way I have it is it compares to strings in identical format but for some reason when I type out the ls command under the...
4,465
Posted By coderanger
and ls -l file1.txt | awk '{print $6}' returns...
and ls -l file1.txt | awk '{print $6}' returns 2010-09-01
echo "The modified date of file is $Filecrtdate" returns Sep

when I change script to read
Filecrtdate=`ls -l file1.txt | awk '{print...
4,465
Posted By coderanger
yes date is in that format which is why i...
yes date is in that format which is why i modified the current date in same format so comparing same string. Now here is the interesting thing. When I type ls -l file1.txt | awk '{print $6}' into...
4,465
Posted By coderanger
No logging into server with putty and using nano...
No logging into server with putty and using nano to open and edit script
4,465
Posted By coderanger
Added the double == still same response. Getting the false. Does it matter that this is BASH???
I am not sure if you are asking for this :-
$ cat f1.sh
#!/bin/sh
Rundate=`date +%Y-%m-%d`
echo $Rundate
Filecrtdate=`date +%Y-%m-%d`
echo $Filecrtdate

if [ $Filecrtdate == $Rundate ]
then...
4,465
Posted By coderanger
Sorry, yes that was actual correct in the code,...
Sorry, yes that was actual correct in the code, just a typo when I entered in post. Any other ideas?
4,465
Posted By coderanger
Dates not comparing correct even the same format
I have the date of the file passed into a variable also current date formatted same passed into a separate variable and compare the two with an if statement and statement always comes up false. Even...
Showing results 1 to 8 of 8

 
All times are GMT -4. The time now is 04:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy