Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>1. Mail notification in zsh:</strong></p> <p>I think it's just like bash; mail notification will take place if the shell knows where to look for mail and if the <code>MAILCHECK</code> parameter is set to a non-negative integer.</p> <p><strong>2. Changing the mail notification message.</strong></p> <p>(from <code>man bash</code>):</p> <pre><code>MAILPATH A colon-separated list of file names to be checked for mail. The message to be printed when mail arrives in a particular file may be specified by separating the file name from the message with a '?'. When used in the text of the message, $_ expands to the name of the current mailfile. Example: MAILPATH='/var/mail/bfox?"You have mail":~/shell-mail?"$_ has mail!"' Bash supplies a default value for this variable, but the location of the user mail files that it uses is system dependent (e.g., /var/mail/$USER). </code></pre> <p>I think <code>zsh</code> is roughly the same, aside from also exposing <code>mailpath</code> as the array version of <code>MAILPATH</code>.</p> <p><strong>3. Running arbitrary commands:</strong></p> <p>In <code>bash</code>, the value of <code>PS1</code> is printed as a command prompt. Unless the <code>promptvars</code> options is unset (it is set by default), the string undergoes parameter expansion, command substitution, arithmetic expansion and quote removal before being used. The second of those means that you can execute arbitrary shell commands as part of the command prompt.</p> <p><code>zsh</code> has the same feature, controlled by the shell option <code>promptsubst</code> (or <code>PROMPT_SUBST</code>, as the manpage says). Unlike <code>bash</code>, the shell options is unset by default. Also, you might find that you are unable to change the value of <code>PS1</code> (if your distro uses prompt themes), because the prompt theme resets <code>PS1</code> before every command prompt.</p> <p>It turns out that <code>zsh</code> has a different mechanism for running shell functions before the prompt is printed (or in other circumstances; I'm just going to focus on this one case). There is an array parameter called <code>precmd_functions</code> whose values are the names of functions which will be run before every prompt. (The prompt theme systems uses this mechanism to reset <code>PS1</code> before it is printed.)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload