diff --git a/01-read_input_PTH.sh b/01-read_input_PTH.sh new file mode 100644 index 00000000..314c287b --- /dev/null +++ b/01-read_input_PTH.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# read the name of the user and print hello + +echo "Hello! What is your name" +read name +echo "Welcome, $name" + +# single quotes prevent the expansion of the variable +echo 'Your name was stored in $name' + +# exercise: write a script that asks the user for a +# filename and create an empty file named after it + +echo "Hey $name, What is your filename?" +read filename +echo "You want $filename" +echo "Creating $filename ..." +touch $filename +echo "$filename creted" +ls +echo "Bye,bye" diff --git a/07-beer.sh b/07-beer.sh index b0b033ce..f4228555 100644 --- a/07-beer.sh +++ b/07-beer.sh @@ -43,3 +43,26 @@ while [ $count -ge 0 ]; do ((count = count - 1)) done + +# PTH -- Exercise from above + +echo "Now we sing about syntax errors!" +echo "How many syntax errors?" +read count + +while [ $count -ge 0 ]; do + if [ $count -ge 2 ]; then + echo "$count little syntax errors causing pains in my head" + echo "changed one line and now my program's dead" + echo "Peyton called the professor and the professor said" + echo "No more syntax errors making your programs dead!" + else + echo "$count little syntax errors causing pains in my head" + echo "changed one line and now my program's dead" + echo "Peyton called the professor and the professor said" + echo "No more syntax errors making your programs dead!" + fi + + ((count = count - 1)) + +done diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 00000000..6490c2af Binary files /dev/null and b/screenshot.png differ