2025-04-23 - bash20250415.sh

#!/bin/bash

# (C) David Vajda
# 2025-04-15
# Bash programmier uebung

firstname="nam1"
aftername="nam2"

if [[ "$firstname" == "$1" && "$aftername" == "$2" ]]
then
    echo "That's me! ;-)"
elif [[ "$firstname" == "$1" && -z "$2" ]]
then
    echo "Maybe it's me :-|"
else
    date
    echo "Hello world"

    cntr=("first" "second" "third" "fourth" "the fith time" "sixth" "seventh" "eighth" "ninth")
    i=0
    while [ $i -lt 10 ]
    do
        echo "hello to the ${cntr[$i]}"
        i=$(($i+1))
    done
    for s in "${cntr[@]}"
    do
        echo "$s"
    done

    l=$(ls)
    i=0
    for s in $l
    do
        echo "$s"
        i=$(($i+1))
        if [ $i -gt 10 ]
        then
            break
        fi
    done
    /bin/bash "$0" "$firstname" "$aftername"
    /bin/bash "$0" "$firstname"
fi