Re: OT: A question about bash scripting

2012-10-30 Thread Ralf Mardorf
On Tue, 30 Oct 2012 08:58:31 +0100, Chris Davies wrote: done=$(date +%s) month=$(date --date @$done +%B) mon=$(date --date @$done +%b) d_y_t=$(date --date @$done +'/%d/%Y %T') I agree, good idea. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subj

Re: OT: A question about bash scripting

2012-10-30 Thread Chris Davies
Ralf Mardorf wrote: > month=$(date +%B) > mon=$(date +%b) > d_y_t=$(date '+/%d/%Y %T') > done=$(date +%s) You've got a horrible race condition in there just waiting to bite you. Try this instead: done=$(date +%s) month=$(date --date @$done +%B) mon=$(date --date @$done +%b) d_y_t

[sloved] OT: A question about bash scripting

2012-10-29 Thread Ralf Mardorf
On Mon, 2012-10-29 at 18:52 -0400, Neal Murphy wrote: > What's the '+100' supposed to do? ### Killall and Restore session started=$(date +%s) SECONDS=0 sleep 2 ### Time month=$(date +%B) mon=$(date +%b) d_y_t=$(date '+/%d/%Y %T') done=$(date +%s) done_2=$SECONDS ((seconds=(done-start

Re: OT: A question about bash scripting

2012-10-29 Thread Ralf Mardorf
On Mon, 2012-10-29 at 21:31 +, Dom wrote: > Would this do what you are after? > > ### Killall and Restore session > started=$(date +%s) > sleep 2 > > ### Time > month=$(date +%B) > mon=$(date +%b) > d_y_t=$(date '+/%d/%Y %T') > done=$(date +%s) > echo > printf "Attended time to restore sessio

Re: OT: A question about bash scripting

2012-10-29 Thread Neal Murphy
On Monday, October 29, 2012 04:31:03 PM Ralf Mardorf wrote: > FOR YOUR EXAMPLE, IIUC IT SHOULD BE? ... > > ### Killall and Restore session > started=$(date +%s) > sleep 2 > > ### Time > month=$(date +%B) > mon=$(date +%b) > d_y_t=$(date '+/%d/%Y %T') > done=$(date +%s) > #((seconds=(don

Re: OT: A question about bash scripting

2012-10-29 Thread Dom
On 29/10/12 20:31, Ralf Mardorf wrote: (trimmed) I want ((seconds=(done-started)-(((done-started)/60)*60)+100)) min_sec=$(((done-started)/60))":"${seconds: -2} in one line, instead of two lines. I don't understand your reply. Even if I would add ${min_sec: 2} to each "echo" command (ther

Re: OT: A question about bash scripting

2012-10-29 Thread Ralf Mardorf
> ... WHILE I WONT THIS 2 lines, AS ONE LINE, INCLUDING THE FORMATTING: Oops, an evil typo ;), it should be "... while I want". The capital letters aren't for shouting, just to distinguish the mail's text from the script. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a

Re: OT: A question about bash scripting

2012-10-29 Thread Ralf Mardorf
On Mon, 2012-10-29 at 15:59 -0400, Neal Murphy wrote: > On Monday, October 29, 2012 03:26:20 PM Ralf Mardorf wrote: > > > On Mon, 2012-10-29 at 15:00 -0400, Wolf Halton wrote: > > > > On Mon, Oct 29, 2012 at 6:57 AM, Ralf Mardorf > > > > > > > > wrote: > > > > > Hi :) > > > > > > > > > >

Re: OT: A question about bash scripting

2012-10-29 Thread Neal Murphy
On Monday, October 29, 2012 03:26:20 PM Ralf Mardorf wrote: > On Mon, 2012-10-29 at 15:00 -0400, Wolf Halton wrote: > > On Mon, Oct 29, 2012 at 6:57 AM, Ralf Mardorf > > > > wrote: > > > Hi :) > > > > > > how can I get rid of the variable "seconds"? > > > > > > ((seconds=(done-started)-(((done-

Re: OT: A question about bash scripting

2012-10-29 Thread Ralf Mardorf
On Mon, 2012-10-29 at 15:00 -0400, Wolf Halton wrote: > On Mon, Oct 29, 2012 at 6:57 AM, Ralf Mardorf > wrote: > > Hi :) > > > > how can I get rid of the variable "seconds"? > > > > ((seconds=(done-started)-(((done-started)/60)*60)+100)) > > min_sec=$(((done-started)/60))":"${seconds: -2} > >