#!/bin/sh # SP1 Aufgabe "Clash" in POSIX shell (meta-circular style) # $Id: clash.sh,v 1.2 2024/04/13 11:21:42 oj14ozun Exp oj14ozun $ # https://wwwcip.cs.fau.de/~oj14ozun/src+etc/clash.sh while true do printf "%s> " "$PWD" read -r INPUT_LINE CMD="$(echo $INPUT_LINE | sed 's/ .*$//')" REST="$(echo $INPUT_LINE | sed 's/^.*? //')" if [ "$CMD" = 'cd' ] then cd "${REST%% }" elif [ "$CMD" = 'jobs' ] then jobs else LAST="$CMD" EXEC="$(for TOK in $REST do printf " \'%s\'" "$TOK" done)" if [ "$LAST" = "&" ] then eval "$EXEC" & else eval "$EXEC \"$LAST\"" fi fi done