Re: Bash bug

2016-08-22 Thread Eduardo Bustamante
You can do: local var; var=$(...); ... $? No need to make the declaration and assignment at the same time.

Re: Bash bug

2016-08-22 Thread Clark Wang
On Tue, Aug 23, 2016 at 2:34 AM, Weshakie Löwe wrote: > When storing the value of code executed in a subshell the return value is > always 0 if the variable is local. > > Code example: > > A(){ > local return_value="$(bash -c "exit 1")" > echo $? > } > > function A: returns

Re: smart indented HERE docs

2016-08-22 Thread Paul Donohue
I agree something like this would be nice. Especially if it could handle spaces (in addition to tabs). My current solution to this problem is not particularly pretty or elegant: #!/bin/bash alias CAT_TO_END="I=\"\${I/*\$'\n'/}\" ; alias START=\"perl -ple 's/^\$I//' <<'\${I}END' ; unalias

Bash bug

2016-08-22 Thread Weshakie Löwe
When storing the value of code executed in a subshell the return value is always 0 if the variable is local. Code example: A(){ local return_value="$(bash -c "exit 1")" echo $? } function A: returns 0 - even though obviously the return value is 1. B(){ return_value="$(bash -c "exit 1")"

Syslog output from bash

2016-08-22 Thread Richard Lohman
Hey all: In my attempts to log commands from bash via syslog, I've come upon a snag. The output is of the form: Mmm dd HH:MM:SS hostname -bash: command This was obtained by uncommenting the define in config-top.h and changing the call to syslog in bashhist.c as such:

redirection inside a process-substitution

2016-08-22 Thread helmut . karlowski
When doing redirection inside a sub-process to a descriptor that is redirected to a file the output of the subshell goes into the file. Now when the same descriptor is again redirected to another descriptor for this whole command-list, the output of the sub-process goes to the other descriptor.

Bash completion sometimes meshes up my terminal

2016-08-22 Thread Jaro Punta
I am not sure this is a bug but I cannot find an explanation why this happens. Sometimes when I execute certain commands, and I press the Tab key while I am typing the command, then after the commands finishes, the terminal is left in a abnormal state (e.g. terminal echo is off). This seems to

Re: a patch to fix sh_stat on SunOS

2016-08-22 Thread Chet Ramey
On 8/21/16 10:36 PM, Dmitry Goncharov wrote: >> But why should bash override the semantics that an OS provides for >> /dev/fd, resulting in differing behavior between the shell and other >> utilities with the same pathname argument? > > For the benefit of the user. Currently bash behavior is

Re: Patch to fix braces test

2016-08-22 Thread Chet Ramey
On 8/21/16 10:14 PM, Dmitry Goncharov wrote: > Good morning. > > The patch in the attachment fixes the test in braces.c. > > Repace free_array with strvec_dispose. > Remove unused fatal_error and report_error to > eliminate linking failures. Thanks for the report and fix. Chet -- ``The lyf

Re: Patch to fix a leak in expand_amble.

2016-08-22 Thread Chet Ramey
On 8/21/16 10:11 PM, Dmitry Goncharov wrote: > Good morning. > > The patch in the attachment fixes a leak in expand_amble. Thanks for the report and fix. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey,