When parameters are passed and bash exists, execute them after forwarding, in case user wants to do append sth. like -ic l to use the l aliases noninteractively
This commit is contained in:
parent
3dd251f192
commit
eead7fa295
1 changed files with 2 additions and 4 deletions
|
|
@ -65,10 +65,8 @@ bashrc_forward () {
|
|||
_argv_wrap () {
|
||||
if >/dev/null 2>&1 command -v bash; then
|
||||
bash -c '\''
|
||||
if [ "$#" -gt 0 ]; then
|
||||
builtin exec -- bash "$@"
|
||||
#-# Newest Bash feature used here is parameter transformation (`${_s@A}`), introduced in Bash 4.4
|
||||
elif ! ((BASH_VERSINFO[0]>4||(BASH_VERSINFO[0]==4&&BASH_VERSINFO[1]>=4))) 2>/dev/null; then
|
||||
if ! ((BASH_VERSINFO[0]>4||(BASH_VERSINFO[0]==4&&BASH_VERSINFO[1]>=4))) 2>/dev/null; then
|
||||
>&2 echo "Failed to SSH with .bashrc-forwarding, the Bash version is too old."
|
||||
>&2 echo "Please install Bash 4.4 or newer on the target system and make it available in the PATH."
|
||||
>&2 echo "Falling back to default login shell: '\''\'\'''\''${SHELL:-${0#-}}'\''\'\'''\''."
|
||||
|
|
@ -133,7 +131,7 @@ bashrc_forward () {
|
|||
)" DEBUG
|
||||
'\''\'\'''\''
|
||||
) \
|
||||
builtin exec -a sh bash -l # TODO: Login shell is only the default with SSH. With docker run, for example, it is not!
|
||||
builtin exec -a sh bash -l "$@" # TODO: Login shell is only the default with SSH. With docker run, for example, it is not!
|
||||
#-# Note for the exec above: `ENV` is read if and only if bash is invoked as `sh` (or `-sh`), which we enforce using `exec -a sh ...`.
|
||||
#-# Additionally, when invoked just as `sh`, it never reads `~/.bashrc` (or `/etc/bash.bashrc`), because of the implicit posix mode.
|
||||
#-# When invoked as a login shell however (either by having a leading dash in `argv[0]` or with `--login/-l`),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue