Exec bash and reset IFS to default

This commit is contained in:
cubernetes 2026-10-23 17:39:36 +02:00
parent d64c54f994
commit f1573d922d

View file

@ -62,9 +62,11 @@ bashrc_forward () {
printf %s ' printf %s '
#-# If bashrc was forwarded using environment variable, unset it, since we do not need it anymore and to keep the env clean. Relaying will set it anyways to something fresh. #-# If bashrc was forwarded using environment variable, unset it, since we do not need it anymore and to keep the env clean. Relaying will set it anyways to something fresh.
unset FORWARDED_BASHRC unset FORWARDED_BASHRC
#-# Set default IFS, since our staging command line may not contain double quotes since they behave weirdly in powershell.
IFS=$(printf '\'' \t\n.'\''); IFS=${IFS%.}
_argv_wrap () { _argv_wrap () {
if >/dev/null 2>&1 command -v bash; then if >/dev/null 2>&1 command -v bash; then
bash -c '\'' exec bash -c '\''
#-# Newest Bash feature used here is parameter transformation (`${_s@A}`), introduced in Bash 4.4 #-# Newest Bash feature used here is parameter transformation (`${_s@A}`), introduced in Bash 4.4
if ! ((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 "Failed to SSH with .bashrc-forwarding, the Bash version is too old."