105.1 Customize and use the shell environment — Lesson 3

Livestream date: 2026-05-24

Weight 4

Key knowledge areas

  • Set environment variables (e.g. PATH) at login or when spawning a new shell.
  • Write Bash functions for frequently used sequences of commands.
  • Maintain skeleton directories for new user accounts.
  • Set command search path with the proper directory.

Homework 1:

Read-only functions are those whose contents we cannot modify. Do a research on readonly functions and complete the following table:

Function Name Make it readonly List all readonly Functions
my_fun

Homework 2:

Search the web for how to modify PS1 and anything else you may need to write a function
called fyi (to be placed in a startup script) which gives the user the following information:

  • name of the user
  • home directory
  • name of the host
  • operating system type
  • search path for executables
  • mail directory
  • how often mail is checked
  • how many shells deep the current session is
  • prompt (you should modify it so that it shows @)
  1. declare -r my_fun , read only can be executed by scrip and can not be altered. or maby you ment declare -f | grep fun

  2. dump this in home/.bashrc
    name=$USER
    home=$PWD
    host=$HOSTNAME
    system=“Linux”
    rcpath=“etc/bash.bashrc”
    mail=“/var/spool/mail”
    mailcheck=$CHECK-INTERVAL
    depth=$SHLVL
    prompt=“$PS1 \@”

    function fyi { echo “Name: $name”
    echo “Current directory: $home”
    echo “Current pc: $host”
    echo “Operating system: $system”
    echo “Executables path: $rcpath”
    echo “Mail path: $mail”
    echo “Mail interval in seconds: $mailcheck”
    echo “Current shell depth: $depth”
    echo “System prompt starts with: $prompt”
    } fyi

  3. dont like bash scripting atm xD