Re: [ast-users] [ksh93] interactive ksh always exits 0 on CTRL-D

2012-12-06 Thread Janis Papanagnou
Subject: Re: [ast-users] [ksh93] interactive ksh always exits 0 on CTRL-D Not a big problem but I think it better exit $?. I tried the following and it did not exit 0. $ ksh $ false ^D $ print $? 1 David Korn d...@research.att.com Do we need some specific ksh version to

Re: [ast-users] ksh88 vs 93 behavior re: hex numbers

2013-02-28 Thread Janis Papanagnou
With my ksh93 Version JM 93t+ 2010-03-05 I get what you expect $ typeset -i16 HEX=16#ff $ print $HEX 16# Date: Thu, 28 Feb 2013 18:43:52 -0800 From: patgeis...@gmail.com To: ast-users@lists.research.att.com Subject:

Re: [ast-users] Check out my profile on LinkedIn

2013-07-15 Thread Janis Papanagnou
I'm very sorry for this. This is what I got for trusting that Linkedin only contacts people with existing Linkedin profiles. Your experience can be summarized... Abandon all hope, ye who enter here. [Dante] Ced

Re: [ast-users] Can't pass parameters to an instance constructor

2013-07-16 Thread Janis Papanagnou
Hi, here x.val is assigned after the constructor has already run. It should be assigned before so it's accessiable to the create: typeset -T X=( integer val function create { ((_.val++)) }) X x=(val=5) print -v x.val # should print 6 ksh93 currently

Re: [ast-users] Edit 10GB file with fixed size records

2013-07-26 Thread Janis Papanagnou
Does ksh have an API to edit a file at a specific position pos1, read n1 bytes, and write n1 bytes at that position without truncating the file? I need this to do edit a file in place without reading and writing it completely each time. Yes, ksh has seek redirection operators. [snip]

Re: [ast-users] Passing a file descriptor to a child process?

2013-07-29 Thread Janis Papanagnou
From: tina.harriott.mathemat...@gmail.com On 29 July 2013 14:40, David Korn d...@research.att.com wrote: cc: tina.harriott.mathemat...@gmail.com Subject: Re: [ast-users] Passing a file descriptor to a child process? ksh93 uses O_CLOEXEC to avoid passing all its file

Re: [ast-users] Arithmetic assignment side-effects

2013-08-06 Thread Janis Papanagnou
Go strictly from left to right. How do you assign something that hasn't been evaluated yet? Evaluating the expression on the RHS is an absolute prerequisite to evaluating the assignment itself. (x += x) = 1 is nonsense. It evaluates to 0 = 1. It makes sense, depending on the

Re: [ast-users] Arithmetic assignment side-effects

2013-08-06 Thread Janis Papanagnou
Oops. Should have been... (x += x) = 1 is nonsense. It evaluates to 0 = 1. It makes sense, depending on the language. With LVALUE=RVALUE and LVALUE+=LVALUE, where the result is an LVALUE, consider it evaluated as LVALUE+=RVALUE (ref(x) = deref(x)+deref(x)) = 1 (Try your

Re: [ast-users] Question about the nounset option

2013-10-16 Thread Janis Papanagnou
I understand the OP considering that clumsy. And something being defined by POSIX doesn't prevent it being clumsy or not defined in an optimal way; sometimes even the opposite is true. But I'd rather like to abstain from such flame-prone valuations and consider the given application. @Axel: I'm

Re: [ast-users] operations on an entire array

2013-12-13 Thread Janis Papanagnou
Probably not as compact as you'd wish... $ x=( 1 2 3 4 5 6 7 8 9 10 ) $ echo $(( $( printf +%d ${x[@]} ) )) 55 From: joshua.tay...@sub-verses.org Date: Fri, 13 Dec 2013 14:53:24 +0100 To: ast-users@lists.research.att.com Subject: [ast-users] operations on an entire array I was wondering

Re: [ast-users] Raw command substitution $()

2013-12-16 Thread Janis Papanagnou
Can you exclude any character from your input data to be used as a separator? Then you could redefine the read separator (in the example below I used X): printf \n\n\n\n\n | IFS= read -dX FOO Date: Mon, 16 Dec 2013 21:02:01 + From: eschulm...@bloomberg.net To:

Re: [ast-users] Bad math for right shift () 64 bits?

2013-12-30 Thread Janis Papanagnou
Interested in the behaviour I tried that with my version (Version JM 93t+ 2010-03-05( and it gives the same result. Moreover I noticed that in integerb=$((2**32)) ; for ((i=0;i=97;i++)) ; do printf %5d\t%12d\n $i $(( b i )) ; done typeset -i b=$((2**32)) ; for ((i=0;i=97;i++)) ; do printf

Re: [ast-users] Configuring what goes into the history file

2014-01-02 Thread Janis Papanagnou
Subject: Configuring what goes into the history file. Yes, Ed, probably (I haven't checked bash). And I think zsh has something as well. But I am specifically asking for ksh, since that is the shell I mostly use. So I suppose there's no such feature in ksh? (And hardly a workaround, I guess.)

Re: [ast-users] Configuring what goes into the history file

2014-01-03 Thread Janis Papanagnou
Omitting immediate duplicates as default seems reasonable to me. It would be simple, and need no additional external controls. Nice. Defining the beaviour through some means (env var or something) would allow more control variants; like omitting duplicates even if not adjacent in the file - the

Re: [ast-users] Strange printf %T behaviour

2014-04-05 Thread Janis Papanagnou
From: iszczesn...@gmail.com To: janis_papanag...@hotmail.com CC: ast-us...@research.att.com; glenn.s.fow...@gmail.com On Sat, Apr 5, 2014 at 12:24 PM, Janis Papanagnou janis_papanag...@hotmail.com wrote: Please note the empty output lines of commands that previously showed output

[ast-users] A real number arithmetic issue

2014-06-25 Thread Janis Papanagnou
I've just noticed something strange with real number arithmetic in ksh. The problem: It seems that the fractional part in a division is interpreted as integer. $ print $(( log(2.171828) )) 0.775569209249095711 $ print $(( log(200.0) / log(2.171828) )) ksh: log(200.0) / log(2.171828) :

Re: [ast-users] A real number arithmetic issue

2014-07-03 Thread Janis Papanagnou
To: janis_papanag...@hotmail.com; ast-users@lists.research.att.com I suspect that this is because you are running a very old ksh93. Here is what I get on ubuntu linux x86_63.13.0-30-generic4 release . [...] On Wed, Jun 25, 2014 at 3:59 PM, Janis Papanagnou janis_papanag...@hotmail.com wrote

Re: [ast-users] making wildcards safer

2014-07-12 Thread Janis Papanagnou
You are asking: Has this already been considered and rejected for reasons of which I'm unaware, or does it sound reasonable to others? As far as a quick view over the linked document can show I have got the impression that the mentioned problems arise where '--' is not used (or not available?)

[ast-users] Order of arguments significant with heredocs and process substitution?

2015-01-02 Thread Janis Papanagnou
Is the error in case 4 intentional behaviour...? # case 1 - okay cat - EOT | ... EOT awk '1' ( ... ) - # case 2 - okay awk '1' ( ... ) - EOT ... EOT # case 3 - okay awk '1' ( ... ) EOT - ... EOT # case 4 - error: `)' unexpected awk '1' EOT ( ... ) - ... EOT # case 5 - okay print ...

[ast-users] Problem with ksh read -n

2015-03-15 Thread Janis Papanagnou
I observe a problem (see testcase below) with ksh's read -n. (Version 93t 2008-11-04 on Cygwin). Bash's behaviour would be what I expect. Ksh doesn't read the second line and doesn't terminate output. (Maybe an old bug fixed in newer versions? Or am I missing something?) --snip-- $ cat readtest

Re: [ast-users] Problem with ksh read -n

2015-03-17 Thread Janis Papanagnou
technically implemented in the way it is. Not really satisfying. But thanks again. - More insights about why the given read -n behaviour is more sensible than bash's (in this specific read -n case) is welcome. Terrence Doyle On 3/15/15 9:10 AM, Janis

Re: [ast-users] how to get functionality of bash compatible PS1 without rest of bash compatibility?

2015-03-12 Thread Janis Papanagnou
is OTT. There’s got to be a better way… On Mar 12, 2015, at 8:51 AM, Janis Papanagnou janis_papanag...@hotmail.com wrote:To understand your situation... You have already functional code? Your code works but it has a performance problem building the PS1 prompt? If you want something cleaner

Re: [ast-users] Accuracy of FP arithmetics

2015-05-15 Thread Janis Papanagnou
] On Behalf Of Janis Papanagnou Sent: Friday, May 15, 2015 6:23 AM To: ast-us...@research.att.com Subject: [ast-users] Accuracy of FP arithmetics This is a question of *how* does it ksh *right* where other tools (awk) fail. The task was to get the number of digits in a decimal number. (N.B

[ast-users] ksh - printf '%R'

2015-06-12 Thread Janis Papanagnou
It seems that ksh's printf %R is producing wrong results for negated glob-patterns: $ printf %R\n !(*bak) ^(.*bak)!$ $ echo $'abc\nabcbak\ndef' | grep -E '^(.*bak)!$' ...empty result... I'm aware that a conversion of a negation glob to regexp is not trivial to implement, but I'd like to know:

Re: [ast-users] ksh - printf '%R'

2015-07-02 Thread Janis Papanagnou
On Saturday, June 13, 2015 06:59:21 AM Janis Papanagnou wrote: It seems that ksh's printf %R is producing wrong results for negated glob-patterns: $ printf %R\n !(*bak) ^(.*bak)!$ $ echo $'abc\nabcbak\ndef' | grep -E '^(.*bak)!$' ...empty result... [...] Is a regex

[ast-users] Location of ksh man pages?

2016-02-11 Thread Janis Papanagnou
It seems the man pages for ksh88/ksh93 vanished from kornshell.com/doc for some time now. Is there a new location where the official documents can be got from? Janis ___ ast-users mailing list ast-users@lists.research.att.com

Re: [ast-users] trap issue

2017-04-27 Thread Janis Papanagnou
t;bruce.li...@gmail.com> Gesendet: Donnerstag, 27. April 2017 22:51 An: Janis Papanagnou Cc: ast-us...@research.att.com Betreff: Re: [ast-users] trap issue trap ... ERR isn't recognized by NetBSD (supposedly POSIX-compliant) /bin/sh, so any script using that won't run under that shell. Specific

Re: [ast-users] trap issue

2017-04-27 Thread Janis Papanagnou
that the observed behaviour is no bug in ksh but works as designed? - I'd be curious about a rationale for that. Thanks. Janis Von: Bruce Lilly <bruce.li...@gmail.com> Gesendet: Freitag, 28. April 2017 01:44 An: Janis Papanagnou Cc: ast-us...@research.att.com B