[coreutils] skip even the ls aliases in noninteractive mode (suggested by T. Cordes, #988152)

Ondrej Vasik ovasik at fedoraproject.org
Thu Jan 2 10:39:54 UTC 2014


commit 7a1c1f897513cee85365042605a0091e799d22fe
Author: Ondřej Vašík <ovasik at redhat.com>
Date:   Mon Dec 23 10:50:56 2013 +0100

    skip even the ls aliases in noninteractive mode (suggested by T. Cordes, #988152)

 coreutils-colorls.csh |    3 +++
 coreutils-colorls.sh  |    7 +++----
 coreutils.spec        |    6 +++++-
 3 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/coreutils-colorls.csh b/coreutils-colorls.csh
index f2138a9..38abdc7 100755
--- a/coreutils-colorls.csh
+++ b/coreutils-colorls.csh
@@ -1,3 +1,6 @@
+# skip everything for non-interactive shells
+if (! $?prompt) exit
+
 # color-ls initialization
 if ( $?USER_LS_COLORS ) then
   if ( "$USER_LS_COLORS" != "" ) then
diff --git a/coreutils-colorls.sh b/coreutils-colorls.sh
index c71e357..f1b227b 100755
--- a/coreutils-colorls.sh
+++ b/coreutils-colorls.sh
@@ -1,15 +1,14 @@
 # color-ls initialization
 
+# Skip all for noninteractive shells.
+[ -z "$PS1" ] && return
+
 #when USER_LS_COLORS defined do not override user LS_COLORS, but use them.
 if [ -z "$USER_LS_COLORS" ]; then
 
   alias ll='ls -l' 2>/dev/null
   alias l.='ls -d .*' 2>/dev/null
 
-
-  # Skip the rest for noninteractive shells.
-  [ -z "$PS1" ] && return
-
   INCLUDE=
   COLORS=
 
diff --git a/coreutils.spec b/coreutils.spec
index 64067bd..c318d68 100644
--- a/coreutils.spec
+++ b/coreutils.spec
@@ -1,7 +1,7 @@
 Summary: A set of basic GNU tools commonly used in shell scripts
 Name:    coreutils
 Version: 8.22
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: GPLv3+
 Group:   System Environment/Base
 Url:     http://www.gnu.org/software/coreutils/
@@ -372,6 +372,10 @@ fi
 %{_sbindir}/chroot
 
 %changelog
+* Mon Dec 23 2013 Ondrej Vasik <ovasik at redhat.com> 8.22-4
+- skip even the ls aliases in noninteractive mode
+  (suggested by T. Cordes, #988152)
+
 * Sun Dec 22 2013 Ondrej Vasik <ovasik at redhat.com> 8.22-3
 - reset buffer before copying to prevent some rare cases of
   invalid output in join and uniq(#1036289)


More information about the scm-commits mailing list