add greet example
This commit is contained in:
parent
bff43aa294
commit
c105d8b0b6
2 changed files with 78 additions and 1 deletions
29
examples/greet
Executable file
29
examples/greet
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
#!/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" # Get input
|
||||
sfask "Is ${sftbf}${sfin}${sftrs} 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue