/bin/sh should set SHELL to /bin/sh

2017-07-13 Thread John Reiser
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale'

Re: Debugging memory usage

2013-06-24 Thread John Reiser
> I took a look and saw the bash process consuming as much as 3+ GB of > memory. I'm not doing anything where I'd expect to be consuming that > much memory. As a workaround, try using "ulimit -v" to restrict the virtual memory space of the shell itself. (For invoking some child processes, it m

Re: Obsolete SIGRTMAX-n signal names

2013-05-29 Thread John Reiser
On 05/29/2013 01:35 AM, Harald Hoyer wrote: > On 04/24/2013 05:26 PM, Chet Ramey wrote: >> On 4/23/13 2:05 AM, Harald Hoyer wrote: >>> As reported in http://savannah.gnu.org/patch/?8025 , I would like to see the >>> SIGRTMAX-n signal names disappear. >>> >>> Signals should never ever be addressed w

Re: How to match regex in bash? (any character)

2011-09-26 Thread John Reiser
Peng Yu wrote: > I know that I should use =~ to match regex (bash version 4). > > However, the man page is not very clear. I don't find how to match > (matching any single character). For example, the following regex > doesn't match txt. Does anybody know how to match any character > (should b

RFE: indirection_level_string() preserves 'x' flag [PATCH]

2011-09-08 Thread John Reiser
or example, this code prints the script location of every fork(). - // bash-syspose.c - interpose so that bash shell prints $PS4 upon syscall // Copyright 2011 John Reiser, BitWagon Software LLC. All rights reserved. // Licensed under GNU General Public License, version 3 (GPLv3). // // Requir

Re: How to input ^J?

2010-07-18 Thread John Reiser
> Lastly since ^J is a newline you can generate one with echo "\n". That does not work in bash-4.x. Firstly, by default the bash builtin 'echo' supplies a trailing newline. Secondly, backslash translation requires the option "-e". $ echo "\n" \n $ echo "\n" | od -c 000 \ n \n 003 $

Re: Set of characters that are treated specially between a pair of double quotes?

2010-07-11 Thread John Reiser
> Could anybody let me know the complete set of characters that need to > be escaped (prepend with backslash) between a pair of double quotes if > I really want to print the character? RTFM. In particular, the manual page ("man bash") has a succinct section entitled "QUOTING". --

Re: How to input tab in command line?

2010-07-10 Thread John Reiser
> I have command completion in my bash command. But I need to input tab > in the command line. Is there a way to do so? Quote the with V. $ echo ' ' | od -c # e c h o V 000 \t \n 002 $ echo '' | od -c # e c h o 000 \n 001 $ --

Re: A note for read builtin

2010-06-18 Thread John Reiser
On 06/18/2010 07:05 AM, Dr. Werner Fink wrote: > Just a remark about the sub shell usage in bash in comparision to > ksh. Let's try: > > strace -f -o bash.strace bash -c 'echo a b | read a b' > > grep -E 'execve|clone|write\(1|read\(0' bash.strace [snip] > > and now the same with the K

Re: [bash-bug] Can arithmetic evaluation trap more than just division by zero?

2010-04-06 Thread John Reiser
Program received signal SIGFPE, Arithmetic exception. 0x00462cd5 in exp2 () at expr.c:761 761 val1 /= val2; (gdb) print val1 $1 = -9223372036854775808 (gdb) print val2 $2 = -1 which is strange. Not at all. Overflow invokes undefined behaviour. But why there is no overflow on 32bit s

Re: Mixing exec redirection with explicit redirection, unexpected results

2009-12-08 Thread John Reiser
#!/bin/bash > /tmp/foo exec 1>/tmp/foo echo a echo B>>/tmp/foo echo c echo D>>/tmp/foo echo e echo F>>/tmp/foo That script creates two simultaneous writers of /tmp/foo (one via the "exec >", another via each "echo >>") but does not provide any concurrency control. Shame on the script; the resu

Re: slight OT: shell-script programing style -- origins and change?

2009-10-25 Thread John Reiser
... the age old convention of using upper case names for all their shell variables. ... It reminds some programmers that a '$' is necessary for expansion. It is somewhat like using all capitals for #define macros in C (where the expansion is automatic, but still different from other symbols that

Re: preventing pipe reader from existing on writer exiting

2009-09-30 Thread John Reiser
Ultimately I need to do I/O through a named pipe and I need to be able to restart the writer without restarting the reader. The reader of a fifo will not be terminated as long as there is at least one writer to the fifo. Therefore, create a second writer. For example, to hold the fifo open for

Re: Bash does not read up the whole script which it is currently executing

2009-08-04 Thread John Reiser
On 08/04/2009 12:48 AM, fam...@icdsoft.com wrote: First I would like to say that I'm not sure if this is a bug or a feature of Bash. If it is a feature, please let me know how to turn it off; or better make it disabled by default... The problem is that Bash does

omit fork before last exec

2009-08-03 Thread John Reiser
Hi, Would it be possible for bash to detect just-in-time the last subprocess that it will execute, and then do only an 'execve' instead of a fork+execve? This might save a lot of operating system overhead for process creation: perhaps upto 10% over the course of a day, especially for most uses of