sf/examples/greet
2022-01-15 11:53:08 +01:00

29 lines
799 B
Bash
Executable file

#!/usr/bin/env bash
# ----------------------
# sf -- script framework
# ----------------------
# Declare sf variables
sfdesc="Greet a person."
# Include sf, this could be replaced with a long oneliner
source "$(dirname $0)/../sf"
# ----------------------
# Actual script
# ----------------------
sfget "Enter your name" # Get input
echo "Hello ${sfin}!" # Use input
sfask "Do you want to tell me your age" # Ask for YES/no
if [ "$sfin" == true ]; then # Use answer
sfget "Enter your Age" "80" # Get input with default value
sfask "Is $sfin really your age" "no" # Use input and ask for yes/NO
if [ "$sfin" == true ]; then # Use answer
echo "Great!"
else
echo "I knew it!"
fi
fi