Last login: Thu Nov 15 13:50:55 on ttys000
Math-Tuttle-OSX:~ smtuttle$ cd humboldt/f12cs279/279lectures/279lect13-2/

Math-Tuttle-OSX:279lect13-2 smtuttle$ myNum=4
Math-Tuttle-OSX:279lect13-2 smtuttle$ let myNum+=1
Math-Tuttle-OSX:279lect13-2 smtuttle$ echo $myNum
5

Math-Tuttle-OSX:279lect13-2 smtuttle$ expr \( 3 + 4 \) \* 8
56

Math-Tuttle-OSX:279lect13-2 smtuttle$ expr '( 3 + 4 ) * 8'
( 3 + 4 ) * 8

Math-Tuttle-OSX:279lect13-2 smtuttle$ expr 3 \| 4
3

Math-Tuttle-OSX:279lect13-2 smtuttle$ expr 0 \| 4
4

Math-Tuttle-OSX:279lect13-2 smtuttle$ expr 0 \| 0
0

Math-Tuttle-OSX:279lect13-2 smtuttle$ expr "" \| 3
3

Math-Tuttle-OSX:279lect13-2 smtuttle$ expr 3 \& 4
3

Math-Tuttle-OSX:279lect13-2 smtuttle$ expr 3 \& ""
0

Math-Tuttle-OSX:279lect13-2 smtuttle$ expr 134 : 3
0

Math-Tuttle-OSX:279lect13-2 smtuttle$ expr 134 \: 3
0

Math-Tuttle-OSX:279lect13-2 smtuttle$ expr oink \: "[a-z]"
1

Math-Tuttle-OSX:279lect13-2 smtuttle$ expr oink \: "[a-z][a-z]"
2

Math-Tuttle-OSX:279lect13-2 smtuttle$ bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
3*4
12

2^3
8

134%10
4

x=3
x
3

x^3
27

quit

Math-Tuttle-OSX:279lect13-2 smtuttle$ bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
x
0
^D

Math-Tuttle-OSX:279lect13-2 smtuttle$ echo "3*4" | bc
12

Math-Tuttle-OSX:279lect13-2 smtuttle$ myProduct=`echo "3*4" | bc`

Math-Tuttle-OSX:279lect13-2 smtuttle$ echo $myProduct
12

Math-Tuttle-OSX:279lect13-2 smtuttle$ alpha=2
Math-Tuttle-OSX:279lect13-2 smtuttle$ beta=4
Math-Tuttle-OSX:279lect13-2 smtuttle$ my_sum=$alpha + $beta
-bash: +: command not found

Math-Tuttle-OSX:279lect13-2 smtuttle$ my_sum=alpha+beta
Math-Tuttle-OSX:279lect13-2 smtuttle$ echo $my_sum
alpha+beta

Math-Tuttle-OSX:279lect13-2 smtuttle$ my_sum=`expr $alpha + $beta`
Math-Tuttle-OSX:279lect13-2 smtuttle$ echo $my_sum
6

Math-Tuttle-OSX:279lect13-2 smtuttle$ my_sum=0
Math-Tuttle-OSX:279lect13-2 smtuttle$ my_sum="expr $alpha + $beta"
Math-Tuttle-OSX:279lect13-2 smtuttle$ echo $my_sum
expr 2 + 4

Math-Tuttle-OSX:279lect13-2 smtuttle$ sleep 5

Math-Tuttle-OSX:279lect13-2 smtuttle$ emacs beeper.sh

[1]+  Stopped                 emacs beeper.sh

Math-Tuttle-OSX:279lect13-2 smtuttle$ beeper.sh
beep 0
beep 1
beep 2
beep 3
beep 4
beep 5
beep 6
beep 7
beep 8
beep 9
beep 10
beep 11
beep 12
^C

Math-Tuttle-OSX:279lect13-2 smtuttle$ fg
emacs beeper.sh

[1]+  Stopped                 emacs beeper.sh

Math-Tuttle-OSX:279lect13-2 smtuttle$ beeper.sh 5
beep 0
beep 1
beep 2
beep 3
beep 4
FINIS!

Math-Tuttle-OSX:279lect13-2 smtuttle$ time beeper.sh 5 > looky-beep

real			    0m5.366s
user			    0m0.004s
sys			    0m0.009s

Math-Tuttle-OSX:279lect13-2 smtuttle$ man time
Math-Tuttle-OSX:279lect13-2 smtuttle$ time -p beeper.sh 5 > looky-beep
real 5.25
user 0.00
sys 0.00

Math-Tuttle-OSX:279lect13-2 smtuttle$ time -l beeper.sh 5 > looky-beep
-bash: -l: command not found

real   0m0.470s
user   0m0.000s
sys    0m0.002s

Math-Tuttle-OSX:279lect13-2 smtuttle$ time beeper.sh 5 beep 0
beep 1
beep 2
beep 3
beep 4
FINIS!

real	0m5.017s
user	0m0.004s
sys	0m0.008s

Math-Tuttle-OSX:279lect13-2 smtuttle$ emacs callbeep.sh

Math-Tuttle-OSX:279lect13-2 smtuttle$ beeper.sh 60 > looky &
[2] 4604

Math-Tuttle-OSX:279lect13-2 smtuttle$ wait 4604 ; echo "hi"
[2]-  Done                    beeper.sh 60 > looky
hi

Math-Tuttle-OSX:279lect13-2 smtuttle$ beeper.sh 5
beep 0
beep 1
beep 2
beep 3
beep 4
FINIS!

Math-Tuttle-OSX:279lect13-2 smtuttle$ ps g
  PID   TT  STAT      TIME COMMAND
 3723 s000  S      0:00.02 -bash
 3756 s000  S+     0:00.65 emacs 279lect13-2-projected.txt
 1645 s001  S      0:00.02 -bash
 3007 s002  T      0:00.25 emacs beeper.sh
 3724 s003  S      0:00.10 -bash
 4537 s003  T      0:00.14 emacs beeper.sh
 4679 s004  S+     0:00.02 -bash
 4690 s004  S      0:00.01 /bin/bash ./beeper.sh 20
 4697 s004  S      0:00.00 sleep 1

Math-Tuttle-OSX:279lect13-2 smtuttle$ ps g
  PID   TT  STAT      TIME COMMAND
 3723 s000  S      0:00.02 -bash
 3756 s000  S+     0:00.65 emacs 279lect13-2-projected.txt
 1645 s001  S      0:00.02 -bash
 3007 s002  T      0:00.25 emacs beeper.sh
 3724 s003  S      0:00.10 -bash
 4537 s003  T      0:00.14 emacs beeper.sh

Math-Tuttle-OSX:279lect13-2 smtuttle$ ps g
  PID   TT  STAT      TIME COMMAND
 3723 s000  S      0:00.02 -bash
 3756 s000  S+     0:00.65 emacs 279lect13-2-projected.txt
 1645 s001  S      0:00.02 -bash
 3007 s002  T      0:00.25 emacs beeper.sh
 3724 s003  S      0:00.10 -bash
 4537 s003  T      0:00.14 emacs beeper.sh
 4707 s004  S+     0:00.01 -bash
 4715 s004  S      0:00.01 /bin/bash ./beeper.sh 20
 4719 s004  S      0:00.00 sleep 1

Math-Tuttle-OSX:279lect13-2 smtuttle$ ps g
  PID   TT  STAT      TIME COMMAND
 3723 s000  S      0:00.02 -bash
 3756 s000  S+     0:00.65 emacs 279lect13-2-projected.txt
 1645 s001  S      0:00.02 -bash
 3007 s002  T      0:00.25 emacs beeper.sh
 3724 s003  S      0:00.10 -bash
 4537 s003  T      0:00.14 emacs beeper.sh

Math-Tuttle-OSX:279lect13-2 smtuttle$ more looky
beep 0
beep 1
beep 2
beep 3
beep 4
beep 5
beep 6
beep 7
beep 8

Math-Tuttle-OSX:279lect13-2 smtuttle$ ps g
  PID   TT  STAT      TIME COMMAND
 3723 s000  S      0:00.02 -bash
 3756 s000  S+     0:00.65 emacs 279lect13-2-projected.txt
 1645 s001  S      0:00.02 -bash
 3007 s002  T      0:00.25 emacs beeper.sh
 3724 s003  S      0:00.10 -bash
 4537 s003  T      0:00.14 emacs beeper.sh
 4730 s004  S+     0:00.01 -bash
 4740 s004  S      0:00.01 /bin/bash ./beeper.sh 30
 4742 s004  S      0:00.00 sleep 1

Math-Tuttle-OSX:279lect13-2 smtuttle$ ps g
  PID   TT  STAT      TIME COMMAND
 3723 s000  S      0:00.02 -bash
 3756 s000  S+     0:00.65 emacs 279lect13-2-projected.txt
 1645 s001  S      0:00.02 -bash
 3007 s002  T      0:00.25 emacs beeper.sh
 3724 s003  S      0:00.10 -bash
 4537 s003  T      0:00.14 emacs beeper.sh

Math-Tuttle-OSX:279lect13-2 smtuttle$ more looky2
beep 0
beep 1
beep 2
beep 3
beep 4
beep 5
beep 6
beep 7
beep 8
beep 9
beep 10
beep 11
beep 12
beep 13
beep 14
beep 15

Math-Tuttle-OSX:279lect13-2 smtuttle$ ps g
  PID   TT  STAT      TIME COMMAND
 3723 s000  S      0:00.02 -bash
 3756 s000  S+     0:00.65 emacs 279lect13-2-projected.txt
 1645 s001  S      0:00.02 -bash
 3007 s002  T      0:00.25 emacs beeper.sh
 3724 s003  S      0:00.11 -bash
 4537 s003  T      0:00.14 emacs beeper.sh

Math-Tuttle-OSX:279lect13-2 smtuttle$ ls
#callbeep.sh#
279lect13-2-projected.txt
279lect13-2-projected.txt~
beeper.sh
beeper.sh~
looky
looky-beep
looky2

Math-Tuttle-OSX:279lect13-2 smtuttle$ more looky2
beep 0
beep 1
beep 2
beep 3
beep 4
beep 5
beep 6
beep 7
beep 8
beep 9
beep 10
beep 11
beep 12
beep 13
beep 14
beep 15
beep 16
beep 17
beep 18
beep 19
beep 20
beep 21
beep 22
beep 23
beep 24
beep 25
beep 26
beep 27
beep 28
beep 29
FINIS!

Math-Tuttle-OSX:279lect13-2 smtuttle$ ps g
  PID   TT  STAT      TIME COMMAND
 3723 s000  S      0:00.02 -bash
 3756 s000  S+     0:00.65 emacs 279lect13-2-projected.txt
 1645 s001  S      0:00.02 -bash
 3007 s002  T      0:00.25 emacs beeper.sh
 3724 s003  S      0:00.11 -bash
 4537 s003  T      0:00.14 emacs beeper.sh

Math-Tuttle-OSX:279lect13-2 smtuttle$ ps x
  PID   TT  STAT      TIME COMMAND
 1240   ??  Ss     0:04.34 /sbin/launchd
 1243   ??  S      0:01.26 /usr/libexec/UserEventAgent -l 
 1245   ??  U      0:27.72 /usr/sbin/distnoted agent
<...too-long output chopped...>

Math-Tuttle-OSX:279lect13-2 smtuttle$ ps x | grep beep
 3007 s002  T      0:00.25 emacs beeper.sh
 4537 s003  T      0:00.14 emacs beeper.sh

Math-Tuttle-OSX:279lect13-2 smtuttle$ ps x | grep beep
 3007 s002  T      0:00.25 emacs beeper.sh
 4537 s003  T      0:00.14 emacs beeper.sh
 4806 s003  R+     0:00.00 grep beep
 4801 s004  S      0:00.01 /bin/bash ./beeper.sh 30

Math-Tuttle-OSX:279lect13-2 smtuttle$ ps x | grep beep
 4801   ??  S      0:00.01 /bin/bash ./beeper.sh 30
 3007 s002  T      0:00.25 emacs beeper.sh
 4537 s003  T      0:00.14 emacs beeper.sh
 4819 s003  U+     0:00.00 grep beep

Math-Tuttle-OSX:279lect13-2 smtuttle$ jobs
[1]+  Stopped                 emacs beeper.sh

Math-Tuttle-OSX:279lect13-2 smtuttle$ ps x | grep beep
 3007 s002  T      0:00.25 emacs beeper.sh
 4537 s003  T      0:00.14 emacs beeper.sh

Math-Tuttle-OSX:279lect13-2 smtuttle$ more looky2
beep 0
beep 1
beep 2
beep 3
beep 4
beep 5
beep 6
beep 7
beep 8
beep 9
beep 10
beep 11
beep 12
beep 13
beep 14
beep 15
beep 16
beep 17
beep 18
beep 19
beep 20
beep 21
beep 22
beep 23
beep 24
beep 25
beep 26
beep 27
beep 28
beep 29
FINIS!

Math-Tuttle-OSX:279lect13-2 smtuttle$ nice -n 19 beeper.sh 30 > looky3 & 
[2] 4849

Math-Tuttle-OSX:279lect13-2 smtuttle$ ps x
  PID   TT  STAT      TIME COMMAND
 1240   ??  Ss     0:04.36 /sbin/launchd
 1243   ??  S      0:01.26 /usr/libexec/UserEventAgent -l 
<...too-long output chopped...?

Math-Tuttle-OSX:279lect13-2 smtuttle$ ps x | grep beep
 3007 s002  T      0:00.25 emacs beeper.sh
 4537 s003  T      0:00.14 emacs beeper.sh
 4849 s003  SN     0:00.02 /bin/bash ./beeper.sh 30

Math-Tuttle-OSX:279lect13-2 smtuttle$ ps x | grep beep
 3007 s002  T      0:00.25 emacs beeper.sh
 4537 s003  T      0:00.14 emacs beeper.sh
[2]-  Done                    nice -n 19 beeper.sh 30 > looky3

Math-Tuttle-OSX:279lect13-2 smtuttle$ beeper.sh 60 > looky3 & 
[2] 4893

Math-Tuttle-OSX:279lect13-2 smtuttle$ ps x | grep beep
 3007 s002  T      0:00.25 emacs beeper.sh
 4537 s003  T      0:00.14 emacs beeper.sh
 4893 s003  S      0:00.00 /bin/bash ./beeper.sh 60
 4900 s003  R+     0:00.00 grep beep

Math-Tuttle-OSX:279lect13-2 smtuttle$ renice -n 5 -p 4893

Math-Tuttle-OSX:279lect13-2 smtuttle$ ps x | grep beep
 3007 s002  T      0:00.25 emacs beeper.sh
 4537 s003  T      0:00.14 emacs beeper.sh
 4893 s003  SN     0:00.01 /bin/bash ./beeper.sh 60
 4923 s003  S+     0:00.00 grep beep

Math-Tuttle-OSX:279lect13-2 smtuttle$