[gnome-builder] terminal: only take the first line from getent



commit 298509f260e0a39cfab3b5ef994fb04d9edeae21
Author: Christian Hergert <chergert redhat com>
Date:   Thu Mar 9 02:05:11 2017 -0800

    terminal: only take the first line from getent
    
    It is possible to get duplicated lines here, and we just want the first.

 plugins/terminal/gb-terminal-view.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/plugins/terminal/gb-terminal-view.c b/plugins/terminal/gb-terminal-view.c
index eebec55..f834006 100644
--- a/plugins/terminal/gb-terminal-view.c
+++ b/plugins/terminal/gb-terminal-view.c
@@ -95,7 +95,7 @@ gb_terminal_view_discover_shell (GbTerminalView  *self,
   if (cached_shell != NULL)
     return g_strdup (cached_shell);
 
-  command = g_strdup_printf ("sh -c 'getent passwd | grep ^%s: | cut -f 7 -d :'",
+  command = g_strdup_printf ("sh -c 'getent passwd | grep ^%s: | head -n1 | cut -f 7 -d :'",
                              g_get_user_name ());
 
   if (!g_shell_parse_argv (command, NULL, &argv, error))


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