aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2017-10-29 21:02:19 +0100
committerMarius Bakke <mbakke@fastmail.com>2017-11-01 20:29:32 +0100
commit0ab59dd8b8b64d4cd58c42a21e056a6cc8adc0bb (patch)
treef01e21fd69800ebca9d09ac7ca4d27438d07623c
parent83a7a88f93237013a66ec041009dd6add724aaa3 (diff)
downloadpatches-0ab59dd8b8b64d4cd58c42a21e056a6cc8adc0bb.tar
patches-0ab59dd8b8b64d4cd58c42a21e056a6cc8adc0bb.tar.gz
system: Test for interactive shell instead of `cat` in skeleton '.bashrc'.
* gnu/system/shadow.scm (default-skeletons)[bashrc]: Wrap $SSH_CLIENT test in a conditional testing for interactive shell.
-rw-r--r--gnu/system/shadow.scm11
1 files changed, 5 insertions, 6 deletions
diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm
index 236807c70a..58613e620d 100644
--- a/gnu/system/shadow.scm
+++ b/gnu/system/shadow.scm
@@ -157,13 +157,12 @@ if [ -f ~/.bashrc ]; then . ~/.bashrc; fi\n"))
# honor it and otherwise use /bin/sh.
export SHELL
-if [ -n \"$SSH_CLIENT\" -a -z \"`type -P cat`\" ]
+if [[ $- != *i* ]]
then
- # We are being invoked from a non-interactive SSH session
- # (as in \"ssh host command\") but 'cat' cannot be found
- # in $PATH. Source /etc/profile so we get $PATH and other
- # essential variables.
- source /etc/profile
+ # We are being invoked from a non-interactive shell. If this
+ # is an SSH session (as in \"ssh host command\"), source
+ # /etc/profile so we get PATH and other essential variables.
+ [[ -n \"$SSH_CLIENT\" ]] && source /etc/profile
fi
# Adjust the prompt depending on whether we're in 'guix environment'.