this is a fun post about writing a functional linux shell. it’s done in bash, which i didn’t know you could do… i wonder what it is that makes a shell a shell.
fun fact that you can use #!/usr/bin/env <program>
to point to the correct location. you can’t always assume there’s a #!/usr/bin/bash
but there should be an env telling you where it is!
neat little trick taking a $RANDOM then doing modulus %15 + 1 to get a random number between 1 and 15.
echo -n
echoes without a newline.
this line has a lot going on seq 1 $(($RANDOM % 15 + 1)) | while read n; do
so seq
prints out all the numbers between 1 and the end on a line each. then this gets piped into while read n
which is reading the line and whiling it.
this was a nice post for introduction to bash scripting! nifty!