IBM Z and LinuxONE IBM Z

IBM Z

The enterprise platform for mission-critical applications brings next-level data privacy, security, and resiliency to your hybrid multicloud.

 View Only
  • 1.  z/OS 3.1 using zsh

    Posted Wed August 21, 2024 03:45 PM

    I am not terribly unix savvy, but I'm interested in using zsh in z/OS 3.1. Based on the IBM documentation, it seems it's one of those things you either know how to implement and use on your system or you don't. The doc doesn't explain configuring it. I can get into it easily enough just by typing zsh <enter>  but it's clear more configuration is necessary as I get this unresolved prompt:
    $LOGNAME:$PWD:$

    The doc mentions a list of files for zsh, shown below but they don't exist on my system:

    • /etc/zshenv
    • /etc/zprofile
    • /etc/zshrc
    • /etc/zlogin
    • /etc/zlogout

    Perhaps I need to know how to create these files. I guess my question is, am I simply wading in the shallow end of the unix pool here, and using tools like zsh is meant more for the advanced unix admin to know how to configure this stuff?



    ------------------------------
    David Low
    ------------------------------


  • 2.  RE: z/OS 3.1 using zsh

    Posted Mon August 26, 2024 12:03 PM
    Edited by Lorraine Rizzuto Wed August 28, 2024 12:32 PM

    Hi David,

    if those files do not exist on your system and you do not have the RACF rights to create those, you always have the option to create corresponding files in your own HOME directory. The files in /etc are there to provide some meaningful system wide options but can be customized by using the corresponding dot files in your $HOME. The corresponding dot files are:

    .zshenv
    .zprofile
    .zshrc
    .zlogin
    .zlogout

    They are usually located at the root for your home directory, for example $HOME/.zshrc. For a beginning configuration, you should focus on .zshrc and .zprofile. Those two are similar to .profile and .bashrc. The way zsh searches for startup and shutdown files is documented at: https://www.ibm.com/docs/en/zos/3.1.0?topic=shell-files. I agree the documentation IBM provides is underwhelming. However there are lot's of useful articles about zsh config files on the internet. But be warned a lot of the zsh modules mentioned in those articles are not available in the z/OS port! Documentation for available z/OS zsh modules: https://www.ibm.com/docs/en/zos/3.1.0?topic=shell-zsh-modules

    Start with .zshrc, you can create it with touch $HOME/.zshrc, then edit it using vi or you can use the TSO/E ISHELL to create and edit the file. I prefer to edit directly inside z/Unix, using vim. As a matter of fact I think the ISHELL should be banned from earth ;-). Anyway here is a very simple example of  a .zshrc file that I have been using during my testing:

    #-------------------------------------------------------------
    # Alias Definitions follow here
    #-------------------------------------------------------------
    alias lt="ls -laT"
    alias le="ls -laE"
    alias c="clear"
    alias v="vim"
    alias env="env | sort"
    #-------------------------------------------------------------
    # Add our own function path to zsh's fpath
    #-------------------------------------------------------------
    fpath=( ~/.zfunc "${fpath[@]}" )
    #-------------------------------------------------------------
    # Function to get the git branch
    #-------------------------------------------------------------
    parse_git_branch() {
            git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
    }
    #-------------------------------------------------------------$03
    # Create color prompt with git status included                $03
    #-------------------------------------------------------------$03
    autoload -U colors && colors
    export ASCII_TERMINFO=$ROAD4Z_HOME/share/terminfo
    PROMPT_COMMAND='echo -en "\033]0;z/Unix ${HOST}\a"'
    COLOR_DEF='%f'
    NEWLINE=$'\n'
    setopt PROMPT_SUBST
    export PROMPT='%{$fg[blue]%}%n@%M %{$fg[green]%}%d %{$fg[yellow]%}$(parse_git_branch)$COLOR_DEF$NEWLINE%% '

    For the .zshrc file to work for you, you have to create a new directory in your $HOME 

    mkdir -p $HOME/.zfunc

    Because the zsh colors function, available on any other zsh implementation I know of,  you have to get this file from here

    regards

    Ronny



    ------------------------------
    Ronny Funk
    ------------------------------



  • 3.  RE: z/OS 3.1 using zsh

    Posted Thu August 29, 2024 07:58 AM

    Appreciate your response, Thank you. 



    ------------------------------
    David Low
    ------------------------------