ccdn@microlab.sait.edu.au (David Newall) (02/10/90)
This is from bash-1.02 -- the latest version we have. BTW what is the latest version available? MAILCHECK is given a default value of 60, even in a non-interactive shell. This causes it to print a "You have mail" message. Vi uses $SHELL to expand filenames, and it objects to these messages. I think Bash should not set any MAIL variable unless it's an interactive shell. Similarly, I think it should not set the TERM variable. A patch which "fixes" things follows. David Newall Phone: +61 8 343 3160 Unix Systems Programmer Fax: +61 8 349 6939 Academic Computing Service E-mail: ccdn@levels.sait.oz{.au} SA Institute of Technology UUCP: uunet!munnari!pisa.sait.oz!ccdn The Levels, SA, 5095, Australia VAX PSI: 505282622004::ccdn *** variables.c.orig Fri Feb 9 15:11:06 1990 --- variables.c Fri Feb 9 15:12:31 1990 *************** *** 76,81 **** --- 76,82 ---- int string_index = 0; int shell_level; SHELL_VAR *temp_var; + extern int interactive; while (string = env[string_index++]) { *************** *** 99,126 **** set_if_not ("PATH", DEFAULT_PATH_VALUE); set_var_auto_export ("PATH"); ! set_if_not ("TERM", "dumb"); ! set_var_auto_export ("TERM"); set_if_not ("PS1", primary_prompt); set_if_not ("PS2", secondary_prompt); set_if_not ("IFS", " \t\n"); ! /* Default MAILPATH, and MAILCHECK. */ ! set_if_not ("MAILCHECK", "60"); ! if ((get_string_value ("MAIL") == (char *)NULL) && ! (get_string_value ("MAILPATH") == (char *)NULL)) { ! extern char *current_user_name; ! char *tem; ! ! tem = (char *)xmalloc (1 + sizeof (DEFAULT_MAIL_PATH) ! + strlen (current_user_name)); ! strcpy (tem, DEFAULT_MAIL_PATH); ! strcat (tem, current_user_name); ! ! bind_variable ("MAILPATH", tem); ! free (tem); } /* Set up $PWD. */ --- 100,133 ---- set_if_not ("PATH", DEFAULT_PATH_VALUE); set_var_auto_export ("PATH"); ! if (!interactive) ! { ! set_if_not ("TERM", "dumb"); ! set_var_auto_export ("TERM"); ! } set_if_not ("PS1", primary_prompt); set_if_not ("PS2", secondary_prompt); set_if_not ("IFS", " \t\n"); ! if (!interactive) { ! /* Default MAILPATH, and MAILCHECK. */ ! set_if_not ("MAILCHECK", "60"); ! if ((get_string_value ("MAIL") == (char *)NULL) && ! (get_string_value ("MAILPATH") == (char *)NULL)) ! { ! extern char *current_user_name; ! char *tem; ! ! tem = (char *)xmalloc (1 + sizeof (DEFAULT_MAIL_PATH) ! + strlen (current_user_name)); ! strcpy (tem, DEFAULT_MAIL_PATH); ! strcat (tem, current_user_name); ! ! bind_variable ("MAILPATH", tem); ! free (tem); ! } } /* Set up $PWD. */