bug-bash
[Top][All Lists]
Advanced

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

autocd in bash-4.0-rc1


From: Dr. Markus Waldeck
Subject: autocd in bash-4.0-rc1
Date: Mon, 16 Feb 2009 09:18:58 +0100

Hi,

The autocd option is a long awaited bash feature.

Unfortunately I dislike the noisy impementation
which prints every time "cd <dest dir>".

Due to the fact that autocd is off by default 
everyone who actives the option should know what s/he
is doing and does not need a nanny.

If it is not accecptable to make the default behaivor quiet
please apply my patch.

Thanks

Markus

diff -ru bash-4.0-rc1/builtins/shopt.def bash-4.0-rc1.patched/builtins/shopt.def
--- bash-4.0-rc1/builtins/shopt.def     2009-01-04 20:32:23.000000000 +0100
+++ bash-4.0-rc1.patched/builtins/shopt.def     2009-02-16 08:57:37.964912464 
+0100
@@ -83,6 +83,7 @@
 extern int gnu_error_format;
 extern int check_jobs_at_exit;
 extern int autocd;
+extern int autocdquiet;
 extern int glob_star;
 
 #if defined (EXTENDED_GLOB)
@@ -132,6 +133,7 @@
   shopt_set_func_t *set_func;
 } shopt_vars[] = {
   { "autocd", &autocd, (shopt_set_func_t *)NULL },
+  { "autocdquiet", &autocdquiet, (shopt_set_func_t *)NULL },
   { "cdable_vars", &cdable_vars, (shopt_set_func_t *)NULL },
   { "cdspell", &cdspelling, (shopt_set_func_t *)NULL },
   { "checkhash", &check_hashed_filenames, (shopt_set_func_t *)NULL },
diff -ru bash-4.0-rc1/execute_cmd.c bash-4.0-rc1.patched/execute_cmd.c
--- bash-4.0-rc1/execute_cmd.c  2009-01-04 20:32:29.000000000 +0100
+++ bash-4.0-rc1.patched/execute_cmd.c  2009-02-16 08:46:23.340492392 +0100
@@ -99,6 +99,7 @@
 extern int posixly_correct;
 extern int expand_aliases;
 extern int autocd;
+extern int autocdquiet;
 extern int breaking, continuing, loop_level;
 extern int parse_and_execute_level, running_trap;
 extern int command_string_index, line_number;
@@ -3660,6 +3661,11 @@
       xtrace_print_word_list (words, 0);
       goto run_builtin;
     }
+  if (autocdquiet && interactive && words->word && is_dirname 
(words->word->word))
+    {
+      words = make_word_list (make_word ("cd"), words);
+      goto run_builtin;
+    }
 
   if (command_line == 0)
     command_line = savestring (the_printed_command_except_trap);
diff -ru bash-4.0-rc1/shell.c bash-4.0-rc1.patched/shell.c
--- bash-4.0-rc1/shell.c        2009-01-04 20:32:41.000000000 +0100
+++ bash-4.0-rc1.patched/shell.c        2009-02-16 07:59:42.348138201 +0100
@@ -149,6 +149,7 @@
 
 /* Non-zero means to change to a directory name supplied as a command name */
 int autocd = 0;
+int autocdquiet = 0;
 
 /* Tells what state the shell was in when it started:
        0 = non-interactive shell script

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: 
http://www.gmx.net/de/go/multimessenger01




reply via email to

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