Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 37 lines (31 sloc) 0.873 kB
3142442 @singpolyma initial commit
authored
1 #!/bin/sh
2
3 fakeshell() {
4 echo
5 oldifs="$IFS"
6 IFS=""
7 read -p "$ " -r COMMAND
8 IFS="$oldifs"
9 if [ "$COMMAND" = "exit" ]; then exit; fi
10 OUTPUT="`eval "$COMMAND"`"
11 echo "$OUTPUT"
12 echo
13 }
14
15 BOLD="\033[1m"
16 NORMAL="\033[0m"
17
18 echo "What? The file is empty! What happened?"
19 printf "Remember how the output redirection operator erases a file before "
20 printf "writing to it? It turns out that it erases the file even before the "
21 echo "input redirection operator gets a chance to read it!"
22 echo "There is a well-known way around this, which we will see later."
23
24 OUTPUT=""
25 while [ "`cat saved`" != "2nd thing
26 1st thing
27 2nd thing" ]; do
28 printf "Try typing ${BOLD}echo \"2nd thing\" > saved${NORMAL}.\n"
29 printf "Then, ${BOLD}echo \"1st thing\" >> saved${NORMAL}.\n"
30 printf "Then, ${BOLD}echo \"2nd thing\" >> saved${NORMAL}.\n"
31 fakeshell
32 fakeshell
33 fakeshell
34 done
35
36 ./step11
Something went wrong with that request. Please try again.