Re: date +%s ignores TZ

2008-03-01 Thread Philip Rowlands
On Fri, 29 Feb 2008, Bob Proulx wrote: Jan Engelhardt wrote: I wanted to get the number of seconds since the start of the day. echo $[`date +%s` % 86400]; unfortunately does not do the right thing ÿÿ it would show 82800 instead of 0 when it is (local) midnight. I can't think of

Re: date +%s ignores TZ

2008-03-01 Thread Andreas Schwab
Philip Rowlands [EMAIL PROTECTED] writes: I might be misunderstanding the problem, but it seems easy enough to do this calling date only once: $ date +%T | awk -F: '{ print $1 * 3600 + $2 * 60 + $3 }' 67652 This will fail during the day after a DST transition. Andreas. -- Andreas Schwab,

Re: date +%s ignores TZ

2008-03-01 Thread Bob Proulx
Andreas Schwab wrote: This will fail during the day after a DST transition. Which points out a terrible bug in my suggestion of how to map the range of 0-(N-1) to the range of 1-N! Bob wrote this buggy code: case $secondssincedaystart in (0) secondssincedaystart=86400 ;; esac That will

Re: Hide command line arguments

2008-03-01 Thread Bob Proulx
Martin Bernreuther wrote: on a common Linux system, everyone can use e.g. ps and will see running processes of all users including the command line arguments. Yes. This is a long standing reason that programs that deal with secure data such as passwords should avoid putting passwords in the

Re: date +%s ignores TZ

2008-03-01 Thread Jan Engelhardt
On Feb 29 2008 15:26, Bob Proulx wrote: echo $[`date +%s` % 86400]; Note that the $[expression] syntax is deprecated and is scheduled for removal from a future version of the shell. Please convert to using the now standard $((expression)) syntax. echo $(( $(date +%s) % 86400 ));

Re: date +%s ignores TZ

2008-03-01 Thread Bob Proulx
Jan Engelhardt wrote: $(()) is easily confusable with $(), I therefore ask $[] to be not removed, more like the reverse actually. I am not able to influence the decision. I am just reporting how it is documented. Bob ___ Bug-coreutils mailing list