Last login: Tue Oct 16 14:59:46 on ttys011
Math-Tuttle-OSX:~ smtuttle$ cd humboldt/f12cs279/279lectures/279lect09-1
Math-Tuttle-OSX:279lect09-1 smtuttle$ more simple-read.sh
#!/bin/bash
# simple example of using the read command to obtain
# interactive input from the user
# by: Sharon Tuttle
# last modified: 10-10-12
# note the use of the -n option with echo, so it doesn't echo a newline
echo -n "please type something followed by enter: "
read userInput
echo "you entered: <$userInput>"
Math-Tuttle-OSX:279lect09-1 smtuttle$ simple-read.sh
please type something followed by enter: The cow says moo
you entered: <The cow says moo>
Math-Tuttle-OSX:279lect09-1 smtuttle$ emacs foo.txt
[1]+ Stopped emacs foo.txt
279lect09-1-q1-braille.odt
279lect09-1-q2-braille.doc
279lect09-1-q2-braille.odt
279lect09-1.odt
279lect09-1.pdf
foo.txt
foo2.txt
foo2.txt~
looky
pig1.txt
simple-read.sh
stuff.txt
Math-Tuttle-OSX:279lect09-1 smtuttle$ rm *~
remove foo2.txt~? y
Math-Tuttle-OSX:279lect09-1 smtuttle$ diff foo*
3a4
> BOO!
Math-Tuttle-OSX:279lect09-1 smtuttle$ diff -c foo*
*** foo.txt 2012-10-16 15:19:41.000000000 -0700
--- foo2.txt 2012-10-16 15:19:54.000000000 -0700
***************
*** 1,5 ****
--- 1,6 ----
foo 1
foo 2
foo 3
+ BOO!
foo 4
foo 5
Math-Tuttle-OSX:279lect09-1 smtuttle$ emacs foo.txt
[2]+ Stopped emacs foo.txt
Math-Tuttle-OSX:279lect09-1 smtuttle$ rm foo*~
remove foo.txt~? y
# diff won't accept more than 2 arguments
Math-Tuttle-OSX:279lect09-1 smtuttle$ diff *
diff: extra operand `279lect09-1-q1-braille.doc'
diff: Try `diff --help' for more information.
# playing with diff's -b option -- adding blank lines
# and extra blanks to foo.txt to see the effect on diff
Math-Tuttle-OSX:279lect09-1 smtuttle$ diff foo*
1d0
<
4c3,4
< foo 3
---
> foo 3
> BOO!
7d6
<
Math-Tuttle-OSX:279lect09-1 smtuttle$ diff -b foo*
1d0
<
4a4
> BOO!
7d6
<
Math-Tuttle-OSX:279lect09-1 smtuttle$ fg
emacs foo.txt
[2]+ Stopped emacs foo.txt
Math-Tuttle-OSX:279lect09-1 smtuttle$ rm foo*~
rm: foo*~: No such file or directory
Math-Tuttle-OSX:279lect09-1 smtuttle$ diff foo*
1d0
<
4c3,4
< foo 3
---
> foo 3
> BOO!
6,7c6
< foo 5
<
---
> foo 5
Math-Tuttle-OSX:279lect09-1 smtuttle$ diff -b foo*
1d0
<
4a4
> BOO!
7d6
<
Math-Tuttle-OSX:279lect09-1 smtuttle$ ls
279lect09-1-projected.txt
279lect09-1-projected.txt~
279lect09-1-q1-braille.doc
279lect09-1-q1-braille.odt
279lect09-1-q2-braille.doc
279lect09-1-q2-braille.odt
279lect09-1.odt
279lect09-1.pdf
foo.txt
foo2.txt
looky
pig1.txt
simple-read.sh
stuff.txt
Math-Tuttle-OSX:279lect09-1 smtuttle$ wc *
18 84 553 279lect09-1-projected.txt
4 22 151 279lect09-1-projected.txt~
15 197 11776 279lect09-1-q1-braille.doc
164 1356 50899 279lect09-1-q1-braille.odt
17 161 11264 279lect09-1-q2-braille.doc
197 1447 51674 279lect09-1-q2-braille.odt
517 3887 135042 279lect09-1.odt
9381 25545 277148 279lect09-1.pdf
7 10 39 foo.txt
6 11 35 foo2.txt
13 24 87 looky
10 10 50 pig1.txt
13 56 325 simple-read.sh
1 1 4 stuff.txt
10363 32811 539047 total
Math-Tuttle-OSX:279lect09-1 smtuttle$ man wc
Math-Tuttle-OSX:279lect09-1 smtuttle$ emacs wc-tester.txt
[3]+ Stopped emacs wc-tester.txt
Math-Tuttle-OSX:279lect09-1 smtuttle$ wc wc-tester.txt
6 6 24 wc-tester.txt
Math-Tuttle-OSX:279lect09-1 smtuttle$ fg
emacs wc-tester.txt
[3]+ Stopped emacs wc-tester.txt
Math-Tuttle-OSX:279lect09-1 smtuttle$ fg
Math-Tuttle-OSX:279lect09-1 smtuttle$ wc wc-tester.txt
6 6 24 wc-tester.txt
Math-Tuttle-OSX:279lect09-1 smtuttle$ fg
emacs wc-tester.txt
[3]+ Stopped emacs wc-tester.txt
Math-Tuttle-OSX:279lect09-1 smtuttle$ wc wc-tester.txt
7 6 26 wc-tester.txt
Math-Tuttle-OSX:279lect09-1 smtuttle$ wc
this is CS 279
^C
# this time, ended wc with standard input using ctrl-d! (^D)
Math-Tuttle-OSX:279lect09-1 smtuttle$ wc
let's try again oo oo oo a
1 7 28
Math-Tuttle-OSX:279lect09-1 smtuttle$ ls | wc
16 16 279
Math-Tuttle-OSX:279lect09-1 smtuttle$ ls
279lect09-1-projected.txt
279lect09-1-projected.txt~
279lect09-1-q1-braille.doc
279lect09-1-q1-braille.odt
279lect09-1-q2-braille.doc
279lect09-1-q2-braille.odt
279lect09-1.odt
279lect09-1.pdf
foo.txt
foo2.txt
looky
pig1.txt
simple-read.sh
stuff.txt
wc-tester.txt
wc-tester.txt~
Math-Tuttle-OSX:279lect09-1 smtuttle$ wc -c foo.txt
39 foo.txt
Math-Tuttle-OSX:279lect09-1 smtuttle$ wc -l foo.txt
7 foo.txt
Math-Tuttle-OSX:279lect09-1 smtuttle$ wc -w foo.txt
10 foo.txt
Math-Tuttle-OSX:279lect09-1 smtuttle$ wc -wl foo.txt
7 10 foo.txt
Math-Tuttle-OSX:279lect09-1 smtuttle$ who
smtuttle console Oct 8 16:40
smtuttle ttys000 Oct 8 16:42
smtuttle ttys001 Oct 11 15:04
smtuttle ttys002 Oct 11 15:04
smtuttle ttys003 Oct 15 12:01
smtuttle ttys004 Oct 8 16:42
smtuttle ttys005 Oct 8 16:42
smtuttle ttys006 Oct 8 16:42
smtuttle ttys007 Oct 15 12:02
smtuttle ttys008 Oct 8 16:42
smtuttle ttys009 Oct 14 23:38
smtuttle ttys010 Oct 9 12:30
smtuttle ttys011 Oct 16 14:59
smtuttle ttys012 Oct 16 15:03
Math-Tuttle-OSX:279lect09-1 smtuttle$ who | wc -l
14
Math-Tuttle-OSX:279lect09-1 smtuttle$ ls | wc -l
17
Math-Tuttle-OSX:279lect09-1 smtuttle$ !ssh
ssh st10@nrs-labs.humboldt.edu
st10@nrs-labs.humboldt.edu's password:
Last login: Mon Oct 15 14:57:32 2012 from 137.150.7.22
-bash: /usr/local/bin/oraenv: No such file or directory
[st10@nrs-labs ~]$ who
logger pts/0 2012-10-16 10:46 (cip-248.trustwave.com)
te8 pts/3 2012-10-16 12:36 (137.150.92.25)
mts32 pts/4 2012-10-16 15:45 (137.150.184.237)
akm25 pts/6 2012-10-16 15:00 (137.150.173.201)
st10 pts/7 2012-10-16 15:46 (137.150.7.22)
[st10@nrs-labs ~]$ who | wc -l
6
[st10@nrs-labs ~]$ who
logger pts/0 2012-10-16 10:46 (cip-248.trustwave.com)
te8 pts/3 2012-10-16 12:36 (137.150.92.25)
mts32 pts/4 2012-10-16 15:45 (137.150.184.237)
akm25 pts/6 2012-10-16 15:00 (137.150.173.201)
st10 pts/7 2012-10-16 15:46 (137.150.7.22)
cbh23 pts/8 2012-10-16 15:47 (hsu6588.humboldt.edu)
trm36 pts/9 2012-10-16 15:47 (137.150.173.134)
[st10@nrs-labs ~]$ who
logger pts/0 2012-10-16 10:46 (cip-248.trustwave.com)
te8 pts/3 2012-10-16 12:36 (137.150.92.25)
mts32 pts/4 2012-10-16 15:45 (137.150.184.237)
akm25 pts/6 2012-10-16 15:00 (137.150.173.201)
st10 pts/7 2012-10-16 15:46 (137.150.7.22)
cbh23 pts/8 2012-10-16 15:47 (hsu6588.humboldt.edu)
trm36 pts/9 2012-10-16 15:47 (137.150.173.134)
st10 pts/10 2012-10-16 15:48 (137.150.7.22)
[st10@nrs-labs ~]$ cd public_html
[st10@nrs-labs public_html]$ cd f12cs279
[st10@nrs-labs f12cs279]$ ls -l
total 3996
drwx--x--x 2 st10 domain users 4096 Sep 20 23:42 279exam1
-rw-r--r-- 1 st10 domain users 14759 Oct 10 19:41 279ex-list.php
... <chopping overly-voluminous ls output for screen shot posting> ...
-rw-r--r-- 1 st10 domain users 2981 Oct 10 11:52 index.php
[st10@nrs-labs f12cs279]$ history > 279lect09-1-little-hist.txt
[st10@nrs-labs f12cs279]$ exit
logout
Connection to nrs-labs.humboldt.edu closed.
Math-Tuttle-OSX:279lect09-1 smtuttle$ ls
#279lect09-1-projected.txt#
279lect09-1-projected.txt
279lect09-1-q1-braille.doc
279lect09-1-q1-braille.odt
279lect09-1-q2-braille.doc
279lect09-1-q2-braille.odt
279lect09-1.odt
279lect09-1.pdf
foo.txt
foo2.txt
looky
pig1.txt
simple-read.sh
stuff.txt
wc-tester.txt
wc-tester.txt~
Math-Tuttle-OSX:279lect09-1 smtuttle$ ls -l foo*
-rw-r--r-- 1 smtuttle smtuttle 39 Oct 16 15:26 foo.txt
-rw-r--r-- 1 smtuttle smtuttle 35 Oct 16 15:19 foo2.txt
Math-Tuttle-OSX:279lect09-1 smtuttle$ touch foo2.txt
Math-Tuttle-OSX:279lect09-1 smtuttle$ ls -l foo*
-rw-r--r-- 1 smtuttle smtuttle 39 Oct 16 15:26 foo.txt
-rw-r--r-- 1 smtuttle smtuttle 35 Oct 16 15:54 foo2.txt
Math-Tuttle-OSX:279lect09-1 smtuttle$ touch oink
Math-Tuttle-OSX:279lect09-1 smtuttle$ ls
#279lect09-1-projected.txt#
279lect09-1-projected.txt
279lect09-1-projected.txt~
279lect09-1-q1-braille.doc
279lect09-1-q1-braille.odt
279lect09-1-q2-braille.doc
279lect09-1-q2-braille.odt
279lect09-1.odt
279lect09-1.pdf
foo.txt
foo2.txt
looky
oink
pig1.txt
simple-read.sh
stuff.txt
wc-tester.txt
wc-tester.txt~
Math-Tuttle-OSX:279lect09-1 smtuttle$ ls -l oink
'-rw-r--r-- 1 smtuttle smtuttle 0 Oct 16 15:55 oink
Math-Tuttle-OSX:279lect09-1 smtuttle$ wc oink
0 0 0 oink
Math-Tuttle-OSX:279lect09-1 smtuttle$ ls | tee looky | wc -l
17
Math-Tuttle-OSX:279lect09-1 smtuttle$ more looky
279lect09-1-projected.txt
279lect09-1-projected.txt~
279lect09-1-q1-braille.doc
279lect09-1-q1-braille.odt
279lect09-1-q2-braille.doc
279lect09-1-q2-braille.odt
279lect09-1.odt
279lect09-1.pdf
foo.txt
foo2.txt
looky
oink
pig1.txt
simple-read.sh
stuff.txt
wc-tester.txt
wc-tester.txt~
Math-Tuttle-OSX:279lect09-1 smtuttle$ ls | tee looky2 | wc -l>> looky2
Math-Tuttle-OSX:279lect09-1 smtuttle$ more looky2
279lect09-1-projected.txt
279lect09-1-projected.txt~
279lect09-1-q1-braille.doc
279lect09-1-q1-braille.odt
279lect09-1-q2-braille.doc
279lect09-1-q2-braille.odt
279lect09-1.odt
279lect09-1.pdf
foo.txt
foo2.txt
looky
looky2
oink
pig1.txt
simple-read.sh
stuff.txt
wc-tester.txt
wc-tester.txt~
18
Math-Tuttle-OSX:279lect09-1 smtuttle$ ls | tee file1 file2 | grep foo
foo.txt
foo2.txt
Math-Tuttle-OSX:279lect09-1 smtuttle$ diff file1 file2
Math-Tuttle-OSX:279lect09-1 smtuttle$ cat file1
279lect09-1-projected.txt
279lect09-1-projected.txt~
279lect09-1-q1-braille.doc
279lect09-1-q1-braille.odt
279lect09-1-q2-braille.doc
279lect09-1-q2-braille.odt
279lect09-1.odt
279lect09-1.pdf
file1
file2
foo.txt
foo2.txt
looky
looky2
oink
pig1.txt
simple-read.sh
stuff.txt
wc-tester.txt
wc-tester.txt~
Math-Tuttle-OSX:279lect09-1 smtuttle$ cat file2
279lect09-1-projected.txt
279lect09-1-projected.txt~
279lect09-1-q1-braille.doc
279lect09-1-q1-braille.odt
279lect09-1-q2-braille.doc
279lect09-1-q2-braille.odt
279lect09-1.odt
279lect09-1.pdf
file1
file2
foo.txt
foo2.txt
looky
looky2
oink
pig1.txt
simple-read.sh
stuff.txt
wc-tester.txt
wc-tester.txt~
Math-Tuttle-OSX:279lect09-1 smtuttle$ wc file1
20 20 303 file1
Math-Tuttle-OSX:279lect09-1 smtuttle$ ls | tee -a file1 file2 | grep foo
foo.txt
foo2.txt
Math-Tuttle-OSX:279lect09-1 smtuttle$ wc file1 41 41 634 file1
Math-Tuttle-OSX:279lect09-1 smtuttle$ wc file2 41 41 634 file2
Math-Tuttle-OSX:279lect09-1 smtuttle$ emacs file2
Math-Tuttle-OSX:279lect09-1 smtuttle$ diff file1 file2 | tee looky | grep '<'
< 279lect09-1-q1-braille.doc
< 279lect09-1-q1-braille.odt
< 279lect09-1-q2-braille.doc
< 279lect09-1-q2-braille.odt
Math-Tuttle-OSX:279lect09-1 smtuttle$ more looky
3,6d2
< 279lect09-1-q1-braille.doc
< 279lect09-1-q1-braille.odt
< 279lect09-1-q2-braille.doc
< 279lect09-1-q2-braille.odt
10a7
> BOOO!
Math-Tuttle-OSX:279lect09-1 smtuttle$ cd ..
Math-Tuttle-OSX:279lectures smtuttle$ find
usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]
find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]
Math-Tuttle-OSX:279lectures smtuttle$ find . -print
.
./.DS_Store
./279lect01-2
./279lect01-2/279lect01-2-history-local.txt
... <chopping out way-too-voluminous find output --
ALL of the files in the current directory and ALL of
its subdirectories> ...
./279lect09-1/wc-tester.txt
./279lect09-1/wc-tester.txt~
Math-Tuttle-OSX:279lectures smtuttle$