11-16-2017
The timestamps aren't 2 or more days apart yet, only 1.6 days. One counts from midnight while the other counts from present time.
Your proposition works by forcing both times to start from midnight. You could also add 86399 to d2 before division, which will force the value to 'round up'.
This User Gave Thanks to Corona688 For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
cat .servers | while read LINE; do
ssh jason@$LINE $1
done
exit 1
./command.ksh "ls -l ~jason"
Why does this ONLY iterate on the first server in the list? It's not doing the command on all the servers in the list, what am I missing?
Thanks!
JP (2 Replies)
Discussion started by: jpeery
2 Replies
2. UNIX for Dummies Questions & Answers
without using ls, just using echo so purely pattern matching
I can say echo */ <-- lists directories
but how would I match files? surely something like *!/ or * but neither work ?
it seems like there isn't much that I can put in but surely i should be able to put any ascii... (1 Reply)
Discussion started by: james hanley
1 Replies
3. UNIX for Dummies Questions & Answers
Howdie everyone...
I have a shell script RemoveFiles.sh
Inside this file, it only has two commands as below:
rm -f ../../reportToday/temp/*
rm -f ../../report/*
My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it... (2 Replies)
Discussion started by: cheongww
2 Replies
4. Shell Programming and Scripting
Hi everyone,
I have a Linux OS in my PC (older version 9). Its default shell is bash. Whenever I try to run some Perl program it throws error ! eg, if I run this simple PERL program ,
#!/usr/bin/perl
printf "\lHello \n";
$var=3 ;
printf $var;
@list=(1,2,3);
printf "@list";... (6 Replies)
Discussion started by: adc22
6 Replies
5. Ubuntu
completion-ignore-case option doesn't work in my version:
/home/user $ echo $BASH_VERSION
3.2.48(1)-release
/home/user $ ls -l *
-rw-r--r-- 1 user user 0 2009-10-18 00:09 somefile
-rw-r--r-- 1 user user 0 2009-10-18 00:09 Somefile
/home/user $ set completion-ignore-case on
But when I... (2 Replies)
Discussion started by: Sapfeer
2 Replies
6. Shell Programming and Scripting
Hi,
I'm trying to write a script that checks gvfs to see if a mount exists so I can run it from network-manager's status hooks. I thought I'd pipe the output of gvfs-mount -l to grep for the particular mounts I care about. When I do this in a bash script:
cmnd="gvfs-mount -l | grep -i... (4 Replies)
Discussion started by: kcstrom
4 Replies
7. Shell Programming and Scripting
Hello Friends,
My bash script is like this
#!/bin/bash
# request Bourne shell as shell for job
#$ -S /bin/bash
# assume current working directory as paths
#$ -cwd
#$ -N rsync-copy
#
# print date and time
date
rsync -rltD --progress "ssh -i /home/myname/.ssh/id_rsa"... (4 Replies)
Discussion started by: jacobs.smith
4 Replies
8. Shell Programming and Scripting
Hi,
I am using korn shell.
until ]
do
echo "\$# = " $#
echo "$1"
shift
done
To the above script, I passed 2 parameters and the program control doesn't enter inside "until" loop. If I change it to until ] then it does work.
Why numeric comparison is not working with -ne and works... (3 Replies)
Discussion started by: ab_2010
3 Replies
9. Shell Programming and Scripting
Hello, :)
I've an issue with the creation of a directory, All work without it :mad: So, below, my scripts with the debug output :
#!/bin/bash
# PATHS
HOME_BACKUP="/home/backup"
HOME_SCRIPT="/home/scripts/test/backup_server"
TARGET="/var/www"
# DATE
DATE_Ymd=$(date +%Y-%m-%d)
#... (1 Reply)
Discussion started by: Arnaudh78
1 Replies
10. Shell Programming and Scripting
Bash version 4.4.20 / Ubuntu 16.0.4
Hello,
I tried to write a script that gathers some data and passes them to an executable.
The executed application answers with an error. The echo output in the script returns correct values.
If I copy/paste the last echo command, it get's executed... (2 Replies)
Discussion started by: sushi2k7
2 Replies
LEARN ABOUT SUSE
time::julianday
Time::JulianDay(3) User Contributed Perl Documentation Time::JulianDay(3)
NAME
Time::JulianDay -- Julian calendar manipulations
SYNOPSIS
use Time::JulianDay
$jd = julian_day($year, $month_1_to_12, $day)
$jd = local_julian_day($seconds_since_1970);
$jd = gm_julian_day($seconds_since_1970);
($year, $month_1_to_12, $day) = inverse_julian_day($jd)
$dow = day_of_week($jd)
print (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$dow];
$seconds_since_jan_1_1970 = jd_secondslocal($jd, $hour, $min, $sec)
$seconds_since_jan_1_1970 = jd_secondsgm($jd, $hour, $min, $sec)
$seconds_since_jan_1_1970 = jd_timelocal($sec,$min,$hours,$mday,$month_0_to_11,$year)
$seconds_since_jan_1_1970 = jd_timegm($sec,$min,$hours,$mday,$month_0_to_11,$year)
DESCRIPTION
JulianDay is a package that manipulates dates as number of days since some time a long time ago. It's easy to add and subtract time using
julian days...
The day_of_week returned by day_of_week() is 0 for Sunday, and 6 for Saturday and everything else is in between.
ERRATA
Time::JulianDay is not a correct implementation. There are two problems. The first problem is that Time::JulianDay only works with
integers. Julian Day can be fractional to represent time within a day. If you call inverse_julian_day() with a non-integer time, it will
often give you an incorrect result.
The second problem is that Julian Days start at noon rather than midnight. The julian_day() function returns results that are too large by
0.5.
What to do about these problems is currently open for debate. I'm tempted to leave the current functions alone and add a second set with
more accurate behavior.
There is another implementation in Astro::Time that may be more accurate.
GENESIS
Written by David Muir Sharnoff <muir@idiom.com> with help from previous work by Kurt Jaeger aka PI <zrzr0111@helpdesk.rus.uni-stuttgart.de>
based on postings from: Ian Miller <ian_m@cix.compulink.co.uk>; Gary Puckering <garyp%cognos.uucp@uunet.uu.net> based on
Collected Algorithms of the ACM ?; and the unknown-to-me author of Time::Local.
LICENSE
Copyright (C) 1996-1999 David Muir Sharnoff. License hereby granted for anyone to use, modify or redistribute this module at their own
risk. Please feed useful changes back to muir@idiom.com.
perl v5.12.1 2004-02-08 Time::JulianDay(3)