[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 7e30ee814b2cc89318e510239fbc9a571008d893

Ville Skyttä ville.skytta at iki.fi
Mon Apr 13 21:55:57 UTC 2009


The following commit has been merged in the master branch:
commit 86574164df810ecbd53ae841c15b38e5b06dc068
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Tue Apr 14 00:46:12 2009 +0300

    Always use /etc/shells for chsh -s completion, don't complete on
    comment lines in it.
    
    Invoking chsh -l does unwanted things on some systems, such as FreeBSD.

diff --git a/CHANGES b/CHANGES
index 3bbf1b0..a1134cf 100644
--- a/CHANGES
+++ b/CHANGES
@@ -19,6 +19,8 @@ bash-completion (1.x)
   * Remove unused variable RELEASE.
   * Improve aspell dictionary completion: don't hardcode data-dir, get
     canonical dicts from "aspell dicts".
+  * Always use /etc/shells for chsh -s completion, don't complete on comment
+    lines in it.
 
   [ Todd Zullinger ]
   * Make yum complete on filenames after install, deplist, update and upgrade
diff --git a/bash_completion b/bash_completion
index e50da69..6f84e31 100644
--- a/bash_completion
+++ b/bash_completion
@@ -2569,13 +2569,10 @@ _chsh()
 	prev=${COMP_WORDS[COMP_CWORD-1]}
 
 	if [ "$prev" = "-s" ]; then
-	  if [ -f /etc/debian_version ]; then
-	    COMPREPLY=( $( </etc/shells ) )
-	  else
-	    COMPREPLY=( $( chsh -l | grep "^$cur" ) )
-	  fi
+		COMPREPLY=( $( compgen -W '$( grep "^[[:space:]]*/" \
+				/etc/shells 2>/dev/null )' -- $cur ) )
 	else
-	  COMPREPLY=( $( compgen -u -- $cur ) )
+		COMPREPLY=( $( compgen -u -- $cur ) )
 	fi
 
 	return 0

-- 
bash-completion



More information about the Bash-completion-commits mailing list