100825/tex/sh100325.sh

#!/bin/bash

# (c) David Vajda
# 10/03/25
# bash/sh uebung

firstname="David"
lastname="Vajda"

if [[ "$1" == "$firstname" && "$2" == "$lastname" && -z "$3" ]]
then
    echo "that is me"
elif [[ "$1" == "$lastname" && "$2" == "," && "$3" == "$firstname" && -z "$4" ]]
then
    echo "that's me"
else
    date
    echo "hello world"
    i=0
    n=16
    while [ $i -lt $n ]
    do
        if [ $i -eq 0 ]
        then
            echo echo "hello to 1st"
        elif [ $i -eq 1 ]
        then
            echo echo "hello to 2nd"
        elif [ $i -eq 2 ]
        then
            echo echo "hello to 3rd"
        else
            echo "hello to $(($i+1))."
        fi
        i=$(($i+1))
    done
    M=(Dies sind einige Worte vorab, die dann im string ausgegeben werden)
    i=0
    while [ $i -lt ${#M[@]} ]
    do
        echo -n "${M[$i]} "
        i=$(($i+1))
    done
    echo ""
    for s in "${M[@]}"
    do
        echo -n "$s"
    done
    echo ""
    l=$(ls)
    i=0
    for s in $l
    do
        if [ $i -eq 8 ]
        then
            break
        fi
        i=$(($i+1))
        echo "$s"
    done


    /bin/bash "$0" "$firstname" "$lastname"
    /bin/bash "$0" "$lastname" "," "$firstname"
fi