Warning! This site is under development.
This class may be recorded! Its use will be limited to members of the class. Please do not share with others.
Approximate overview
Just because I don’t know how much of this you learned on your own.
VAR=VALUE$VAR.
$ X="Hello World"
$ echo $X
Hello World
VAR=`COMMAND`$ GITFILES=`grep -l git *.md`
$ vi `grep -l git *.md` # Sam edits all the files with git
$((EXP_) $ echo $((3 + 4))
7
if [ TEST ]; then STATEMENTS; fielse clause. And you can separate things with
newlines rather than semicolons.
```
$ X=10
$ if [ $X -gt 0 ]; then echo “$X is positive.”; fi
10 is positive
$ if [ $X -lt 100 ]
then echo “$X is smallish” fi 10 is smallish
$ if [ -f ~/.bashrc ]; then
echo “You have a bashrc file” else echo “Your Unix life is incomplete” fi
while [ TEST ]; do STATEMENTS; done$ X=10
while [ $X -gt 0 ]
do
echo -n "$X "
X=$(($X - 1)) # I may have gotten this wrong; sometimes bash is annoying
done
for VAR in LIST; do STATEMENT; donefor X in *.txt
do
echo "Backing up $X"
cp $X $X.bak
done
for X in `grep -l "Sam" *.txt`
do
echo "Backing up $X"
cp $X $X.bak
done
function NAME { BODY }$ function add {
> RESULT=$(($1 + $2))
> echo $RESULT
> }
$ add 2 3
5
… and what we learn from them
Note: I appreciate the hard work I see in many of the scripts. However, I will still suggest improvements (i.e., make fun of them).
Some comments as we go …
alias wordle="python wordle.cpython.pyc"/tmp/file.$$wc -w verbs.txt | cut -d' ' -f 1wc -w < verbs.txt