Feature request: Add "import" built-in.

2014-08-24 Thread Tim Friske
Hi,

as I see it the "source" built-in is perfect for embedding a sourced
Bash script into the sourcing one while preserving as much of the
environment, specifically the positional and special parameters, as
possible.

What I am missing is the "import" built-in that passes only the
explicitly given arguments from the importing to the imported Bash script.

I currently emulate the behavior I seek for with the following function:

function _import {
  local -r file="$1"
  set -- "${@:2}"
  source "$file" "$@"
}

For details please see my question and the answers on Unix & Linux
Exchange [1].

[1]
http://unix.stackexchange.com/questions/151889/why-does-bashs-source-command-behave-differently-when-called-from-a-function

Cheers
Tim



signature.asc
Description: OpenPGP digital signature


Re: Feature request: Add "import" built-in.

2014-08-24 Thread Andreas Schwab
Tim Friske  writes:

>   set -- "${@:2}"

Aka shift.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



Re: "! true &" sets $? to 1

2014-08-24 Thread Chet Ramey
On 8/23/14, 6:56 AM, Vincent Lefevre wrote:

> Bash Version: 4.3
> Patch Level: 24
> Release Status: release
> 
> Description:
> 
> When a pipeline starting with "!" is run in background, bash sets $?
> to 1 instead of 0. POSIX says:
> 
>   The exit status of an asynchronous list shall be zero.

Thanks for the report.  This will be fixed in the next release of bash.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: [PATCH] long prompts do not show vi search prefix

2014-08-24 Thread Chet Ramey
On 8/23/14, 3:49 AM, Dylan Cali wrote:
> Hello,
> 
> For long prompts (127 chars or longer), vi search mode does not
> display the [/?] prompt prefix.
> 
> I've included a small program below demonstrating the issue, and a
> very small patch fixing it.

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, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/