cd ~/it244/ex
mkdir ex12
cd ex12
pwd
cp ~tsoro/course_files/it244_files/repeat.sh .
cp ~tsoro/course_files/it244_files/five_lines.txt .
ls
./repeat.sh
Enter 5 lines of text when prompted by the script.
cat five_lines.txt
./repeat.sh < five_lines.txt
repeat.sh took its input from the file five_lines.txt
and printed each line on the screen.
who > current_users.txt
cat current_users.txt
ls ~tsoro > gh_dir.txt
cat gh_dir.txt
echo to send a string to a file.
echo foo > lines.txt
cat to display the contents of lines.txt
cat lines.txt
echo bar > lines.txt
cat to display the contents of lines.txt
cat lines.txt
Notice that the previous contents of lines.txt have vanished.
echo bletch >> lines.txt
cat to display the contents of lines.txt
cat lines.txt
Notice that your first line is still there.
echo bling >> lines.txt
cat on lines.txt
cat lines.txt
echo to display a string in your terminal session window
echo bonkers
echo bonkers > /dev/null
Nothing appears in the terminal window since you have sent the string "bonkers"
into oblivion by redirecting the output of echo to /dev/null.
pwd
If not, see me.
nano ex12.sh
chmod 755 ex12.sh
bash ex12.sh > /dev/null
Running ex12.sh this way
will only print error messages.
~tsoro/it244_test/ex12.sh
When the script asks if you are ready for more, hit Return or Enter.