Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > alt.os.linux > #59464
| From | Soviet_Mario <SovietMario@CCCP.MIR> |
|---|---|
| Newsgroups | alt.os.linux |
| Subject | Re: type of Bash variables |
| Date | 2019-10-12 20:36 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <qnt6fo$5da$2@dont-email.me> (permalink) |
| References | <qnsv2d$o6i$1@dont-email.me> <qnsvvf$u80$1@dont-email.me> <qnt393$j7d$1@dont-email.me> <op.z9j663dia3w0dxdave@hodgins.homeip.net> |
Il 12/10/19 20:05, David W. Hodgins ha scritto: > On Sat, 12 Oct 2019 13:41:54 -0400, Soviet_Mario > <SovietMario@cccp.mir> wrote: > >> I mean, when you execute DATE and it outputs the current >> date-time, it converts from the native internal format to >> human readable with the locale. >> I'd like to know if it is possible to grab directly the >> internal representation (same for numbers) and not the >> output text, in order to get efficient (and RELIABLE) >> comparisons to other date-times ... > > See man date. For example, seconds since 1970-01-01 00:00:00 > UTC > (i.e epoch) ... > $ date +%s > 1570902695 > >>>> I'm getting very surprising results trying to do algebric >>>> operation on dates output, like string truncations and so > > Normally bash variables are not typed, allowing the > variable's type > to be controlled by the type of value it's set to. > > If the variable's type has been declared, and an assignment > to a value > not consistent with that type is attempted, the assignment > will not > change the variable's content. For example ... > $ declare -i asdf uh ! DECLARE ! well I must have missed this construct at all :( > $ asdf="x" > $ echo $asdf > 0 when is LET mandatory and when not ? > >> I was trying to add "something" (month ? second ? hour ? day >> ? year ?) to a date :) > > Convert the date to seconds since 1970 started, do the > arithmetic, then > convert to a date format you want to display. The date > command can be > used to convert between formats, including seconds since epoch. i was trying to do so, but I failed (don't remember why) Yes the absolute number of seconds is equivalent to what I was trying > > Regards, Dave Hodgins > -- 1) Resistere, resistere, resistere. 2) Se tutti pagano le tasse, le tasse le pagano tutti Soviet_Mario - (aka Gatto_Vizzato)
Back to alt.os.linux | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
type of Bash variables Soviet_Mario <SovietMario@CCCP.MIR> - 2019-10-12 18:30 +0200
Re: type of Bash variables Chris Elvidge <chris@mshome.net> - 2019-10-12 17:45 +0100
Re: type of Bash variables Soviet_Mario <SovietMario@CCCP.MIR> - 2019-10-12 19:41 +0200
Re: type of Bash variables Bit Twister <BitTwister@mouse-potato.com> - 2019-10-12 12:57 -0500
Re: type of Bash variables Soviet_Mario <SovietMario@CCCP.MIR> - 2019-10-12 20:32 +0200
Re: type of Bash variables William Unruh <unruh@invalid.ca> - 2019-10-13 14:47 +0000
Re: type of Bash variables "David W. Hodgins" <dwhodgins@nomail.afraid.org> - 2019-10-13 11:12 -0400
Re: type of Bash variables Peter 'Shaggy' Haywood <phaywood@alphalink.com.au> - 2019-10-17 17:59 +1100
Re: type of Bash variables "David W. Hodgins" <dwhodgins@nomail.afraid.org> - 2019-10-12 14:05 -0400
Re: type of Bash variables Soviet_Mario <SovietMario@CCCP.MIR> - 2019-10-12 20:36 +0200
Re: type of Bash variables "David W. Hodgins" <dwhodgins@nomail.afraid.org> - 2019-10-12 16:02 -0400
Re: type of Bash variables Paul <nospam@needed.invalid> - 2019-10-12 14:26 -0400
Re: type of Bash variables Soviet_Mario <SovietMario@CCCP.MIR> - 2019-10-12 20:43 +0200
Re: type of Bash variables Paul <nospam@needed.invalid> - 2019-10-12 15:18 -0400
Re: type of Bash variables Soviet_Mario <SovietMario@CCCP.MIR> - 2019-10-12 22:44 +0200
Re: type of Bash variables Ken Hart <kwhart1@frontier.com> - 2019-10-12 18:11 -0400
Re: type of Bash variables "Carlos E.R." <robin_listas@es.invalid> - 2019-10-13 09:16 +0200
Re: type of Bash variables Jasen Betts <jasen@xnet.co.nz> - 2019-10-12 20:20 +0000
Re: type of Bash variables Soviet_Mario <SovietMario@CCCP.MIR> - 2019-10-13 10:41 +0200
Re: type of Bash variables "Carlos E.R." <robin_listas@es.invalid> - 2019-10-13 08:18 +0200
Re: type of Bash variables Chris Elvidge <chris@mshome.net> - 2019-10-13 11:23 +0100
Re: type of Bash variables Soviet_Mario <SovietMario@CCCP.MIR> - 2019-10-13 13:40 +0200
Re: type of Bash variables William Unruh <unruh@invalid.ca> - 2019-10-13 14:43 +0000
Re: type of Bash variables Soviet_Mario <SovietMario@CCCP.MIR> - 2019-10-12 19:44 +0200
Re: type of Bash variables Bit Twister <BitTwister@mouse-potato.com> - 2019-10-12 12:06 -0500
Re: type of Bash variables Soviet_Mario <SovietMario@CCCP.MIR> - 2019-10-12 19:48 +0200
Re: type of Bash variables Richard Kettlewell <invalid@invalid.invalid> - 2019-10-13 08:58 +0100
Re: type of Bash variables Soviet_Mario <SovietMario@CCCP.MIR> - 2019-10-13 10:38 +0200
Re: type of Bash variables William Unruh <unruh@invalid.ca> - 2019-10-13 14:36 +0000
Re: type of Bash variables Soviet_Mario <SovietMario@CCCP.MIR> - 2019-10-13 20:58 +0200
Re: type of Bash variables gazelle@shell.xmission.com (Kenny McCormack) - 2019-10-13 19:04 +0000
Re: type of Bash variables William Unruh <unruh@invalid.ca> - 2019-10-13 19:28 +0000
csiph-web