Zsh

Rating: 
5
Your rating: None Average: 5 (6 votes)

Zsh is a shell designed for interactive use, although it is also a powerful scripting language. Many of the useful features of bash, ksh, and tcsh were incorporated into zsh; many original features were added. The introductory document details some of the unique features of zsh. It assumes basic knowledge of the standard UNIX shells; the intent is to show a reader already familiar with one of the other major shells what makes zsh more useful or more powerful. This document is not at all comprehensive; read the manual entry for a description of the shell that is complete, concise and up-to-date, although somewhat overwhelming and devoid of examples. Alternatively, the user guide offers wordy explanations of many of the shell's features. If you want to read something that has been polished by a professional editor you can buy the book.

Application versions: 
AttachmentSizeDate
File zsh-5.7.1-4.armv7hl.rpm2.23 MB21/01/2020 - 11:23
File zsh-5.8-1.armv7hl.rpm2.23 MB26/10/2020 - 18:20
Changelog: 

- update to latest upstream release

Comments

ntninja's picture

The package works well, but I found a discrepancy with the equivalent code in /etc/bash.bashrc that breaks things like using sdk-deploy-rpm or starting applications from SSH – unlike bash, this zsh only sources /etc/profile.d/*.sh for login and interactive shells, but not otherwise (this behaviour of bash appears to be a SailfishOS specific quirk). To fix this append the following to /etc/zshenv and remove the corresponding sections from /etc/zshrc:

# Provide pathmunge for /etc/profile.d scripts
pathmunge()
{
    if ! echo $PATH | /bin/grep -qE "(^|:)$1($|:)" ; then
        if [ "$2" = "after" ] ; then
            PATH=$PATH:$1
        else
            PATH=$1:$PATH
        fi
    fi
}

# Provide very dumb shopt emulation to make /etc/profile.d/sailfish-version.sh
# work and prevent errors from being logged
shopt()
{
    if [[ $# -eq 2 && $1 = "-q" && $2 = login_shell ]];
    then
        [[ -o login ]]
    else
        echo "zsh: command not found: shopt" >&2
        return 127
    fi
}

_src_etc_profile_d()
{
    #  Make the *.sh things happier, and have possible ~/.zshenv options like
    # NOMATCH ignored.
    emulate -L ksh


    # from bashrc, with zsh fixes
    if [[ ! -o login ]]; then # We're not a login shell
        for i in /etc/profile.d/*.sh; do
            if [ -r "$i" ]; then
                . $i
            fi
        done
        unset i
    fi
}
_src_etc_profile_d

# Do not unset the `shopt` function to that is is also available for the profile script inclusion in login shells
unset -f pathmunge _src_etc_profile_d

This also fixes the error currently logged on zsh interactive startup by emulating a “just-enough” shopt command.