guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/08: system: Test for interactive shell instead of `cat` in skeleton '


From: Marius Bakke
Subject: 03/08: system: Test for interactive shell instead of `cat` in skeleton '.bashrc'.
Date: Wed, 1 Nov 2017 16:35:32 -0400 (EDT)

mbakke pushed a commit to branch master
in repository guix.

commit 0ab59dd8b8b64d4cd58c42a21e056a6cc8adc0bb
Author: Marius Bakke <address@hidden>
Date:   Sun Oct 29 21:02:19 2017 +0100

    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.
---
 gnu/system/shadow.scm | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm
index 236807c..58613e6 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'.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]