Message from discussion
OT: A question about bash scripting
Received: by 10.68.213.103 with SMTP id nr7mr4025457pbc.7.1352142439130;
Mon, 05 Nov 2012 11:07:19 -0800 (PST)
Path: s9ni81975pbb.0!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!novia!news-hub.siol.net!news.mi.ras.ru!goblin2!goblin.stu.neva.ru!aioe.org!bofh.it!news.nic.it!robomod
From: Ralf Mardorf <ralf.mard...@alice-dsl.net>
Newsgroups: linux.debian.user
Subject: Re: OT: A question about bash scripting
Date: Mon, 29 Oct 2012 20:30:02 +0100
Message-ID: <k03c5-lw-1@gated-at.bofh.it>
References: <jZVoe-7HZ-13@gated-at.bofh.it> <k02SK-8uC-13@gated-at.bofh.it>
X-Original-To: debian-u...@lists.debian.org
Old-Return-Path: <ralf.mard...@alice-dsl.net>
X-Amavis-Spam-Status: No, score=-7.01 tagged_above=-10000 required=5.3
tests=[BAYES_00=-2, LDO_WHITELIST=-5, RCVD_IN_DNSWL_NONE=-0.0001,
T_RP_MATCHES_RCVD=-0.01] autolearn=ham
X-Policyd-Weight: using cached result; rate: -7
X-Mailer: Evolution 3.4.4
MIME-Version: 1.0
X-Originalarrivaltime: 29 Oct 2012 19:26:21.0321 (UTC) FILETIME=[46DA2790:01CDB60B]
X-Mailing-List: <debian-user@lists.debian.org> archive/latest/642026
List-ID: <debian-user.lists.debian.org>
Approved: robo...@news.nic.it
Lines: 67
Organization: linux.* mail to news gateway
Sender: robo...@news.nic.it
X-Original-Date: Mon, 29 Oct 2012 20:26:20 +0100
X-Original-Message-ID: <1351538780.1119.14.camel@localhost.localdomain>
X-Original-References: <1351508274.1123.13.ca...@localhost.localdomain>
<CALRLYE=_L+bX-unW-ki4Z8AJqJsesznUOJCi81ztJVR-qF3...@mail.gmail.com>
Bytes: 3359
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
On Mon, 2012-10-29 at 15:00 -0400, Wolf Halton wrote:
> On Mon, Oct 29, 2012 at 6:57 AM, Ralf Mardorf
> <ralf.mard...@alice-dsl.net> 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}
> > ^^^^^^^ the math should replace the
> > variable.
> >
> > ### Killall and Restore session
> > started=$(date +%s)
> > bash "$song_path/session/start-session-$startversion"
> >
> > ### Time
> > month=$(date +%B)
> > mon=$(date +%b)
> > d_y_t=$(date '+/%d/%Y %T')
> > done=$(date +%s)
> > ((seconds=(done-started)-(((done-started)/60)*60)+100))
> > min_sec=$(((done-started)/60))":"${seconds: -2}
> > echo
> > echo "Attended time to restore session: $min_sec"
> > echo -n "Session restored at " ; printf %9.9s $month ; echo $d_y_t
> > echo
> >
> > TIA,
> > Ralf
> >
> >
>
> Ralf,
> I don't understand.
> What are you wanting to do with the script?
> If you don't like the name of the variable, make up another one.
>
> Wolf
This part of a larger script is a stopwatch and I want the math
((done-started)-(((done-started)/60)*60)+100)) inside the formatted
string ${seconds: -2} , instead of a variable.
Something similar to
${((done-started)-(((done-started)/60)*60)+100)): -2}
Similar, because I'm missing something.
Regards,
Ralf
PS: In German:
Das "${seconds: -2}" formatiert den String und statt "seconds" soll dort
((done-started)-(((done-started)/60)*60)+100)) eingefügt werden. Doch
wie?
--
To UNSUBSCRIBE, email to debian-user-REQU...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/1351538780.1119.14.ca...@localhost.localdomain