Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 32 lines (27 sloc) 0.739 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
#!/bin/sh

fakeshell() {
echo
oldifs="$IFS"
IFS=""
read -p "$ " -r COMMAND
IFS="$oldifs"
if [ "$COMMAND" = "exit" ]; then exit; fi
OUTPUT="`eval "$COMMAND"`"
echo "$OUTPUT"
echo
}

BOLD="\033[1m"
NORMAL="\033[0m"

printf "Oh. It looks like our original output got erased. Whenever you use "
printf "the output redirection operator, it erases the file before putting "
printf "anything in it.\nLuckily, there is another operator, "
printf "${BOLD}>>${NORMAL}, which lets us add new output to a file.\n"

OUTPUT=""
while [ "$OUTPUT" != "2nd thing
1st thing" ]; do
printf "Try typing ${BOLD}echo \"1st thing\" >> saved${NORMAL}. "
printf "Then print the contents of ${BOLD}saved${NORMAL}.\n"
fakeshell
fakeshell
done

./step8
Something went wrong with that request. Please try again.