#!/bin/sh
#? ############################################################################
#? #                                                                          #
#? # WARNING                                                                  #
#? #                                                                          #
#? #    Execute commands given in file using shell's eval.                    #
#? #    No validations or sanitations are done, commands are evaluated as is. #
#? #                                                                          #
#? #    ** This allows OS Command Injection! **                               #
#? #                                                                          #
#? #    It's intended functionality. You've been warned.                      #
#? #                                                                          #
#? ############################################################################
#? DESCRIPTION
#?      $0 - simple script to call commands specified in given file
#? SYNOPSIS
#?      $0 file-with-shell-commands
#? VERSION
#?      @(#) %M% %I% %E% %U%
#? AUTHOR
#?      24-jan-24 Achim Hoffmann
# -----------------------------------------------------------------------------
[ x$1 = x--h -o x$1 = x--help ] && \
	ich=${0##*/} && sed -ne "s/\$0/$ich/g" -e '/^#?/s/#?//p' $0 && exit 0

optp=/opt/p/2024:/opt/p/2024/o:/opt/p/2024/usr
PATH=.:${optp}:/bin:/usr/bin:/usr/local/bin:/usr/local/openssl/bin
cmd_file=${1-ff-exec-cmd.txt}
l='-------------------------------------------------------------------------------'

IFS="
"
gelb='\033[1;33m'   # scary, depends on shell and it's build-in echo
 off='\033[0m'      # ... using  /bin/echo -n -e  instead of echo may help
for line in `cat $cmd_file`; do
	echo -n "$gelb % $line $off"
	read yesno
	[ -n "$yesno" ] && continue
	eval $line
	echo "$l"
	echo
done

exit

