These are a few shell scripts I’ve written. Maybe one will make you 🤔.
This short script takes a text file as an argument and reads it to you. You will need to install espeak for this to work.
sudo apt install espeak
#!/bin/bash
FILE=$1
while read LINE; do
echo "$LINE"
espeak -v en-uk -s 145 -p 42 -a 200 "$LINE"
done < $FILE
If you think you’ve heard that voice before, you might have. I tried to tune espeak to be as close as possible to SCP-079. Here’s a text file for you to try it out on.
This script queries the MovieDB API to search a keyword and return a list of relevant movies. I ended up creating one atrocity of a JSON parser with sed but it works great. I was inspired to make this after making a site using lowdown and ssg5, another (much better) static site generator.
I did some experimenting with postscript using groff. This script makes a postscript document with the atomic structure of different states of matter. It also automatically generates a PDF as long as you have ps2pdf installed.
#!/bin/bash
# Written by Sean Smith
# Date: 12/9/2020
# This program generates a PostScript document that illustrates the atomic
# structure of the different states of matter. Every time the program is run
# a random patern of atoms will exist in the liquid and gas diagrams.
# They change every time you run the program!
FILENAME=$1
CIRCLE="\D\'c.12i\'"
if [ $# -eq 0 ]
then
echo "ERROR: No argument!"
echo "This program takes one argument, the name of the file you want to generate"
echo "Example: \"./gen.sh file\" will generate file.ps and file.pdf"
exit 1
fi
echo "Generating $FILENAME.pdf"
FILE=$FILENAME.troff
#remove file if it already exists
rm $FILE
#create the header
echo "\.ps 24" >> $FILE
echo "\.vs 16" >> $FILE
echo "\.ce" >> $FILE
echo "" >> $FILE
echo "" >> $FILE
echo "Sean Smith \\\" This file was generated by a script" >> $FILE
echo "" >> $FILE
echo "\.ps 16" >> $FILE
echo "Atoms arranged in the three states of matter" >> $FILE
echo "" >> $FILE
#prepare to create the diagrams
echo "\.ps 20" >> $FILE
echo "\.vs 7" >> $FILE
echo "" >> $FILE
echo "" >> $FILE #spacer
echo "" >> $FILE
#generate solid state of matter matrix
echo "Solid" >> $FILE
echo "" >> $FILE
echo "" >> $FILE
for (( j=0; j<12; j++))
do
for (( i=0; i<12; i++ ))
do
echo $CIRCLE >> $FILE
done
echo "" >> $FILE
done
echo "" >> $FILE
echo "" >> $FILE #spacer
echo "" >> $FILE
#generate liquid state of matter matrix
echo "Liquid" >> $FILE
echo "" >> $FILE
echo "" >> $FILE
for (( j=0; j<12; j++))
do
for (( i=0; i<12; i++ ))
do
#gen random number
if [ $((RANDOM%2)) == 0 ]
then
echo $CIRCLE >> $FILE
else
echo "\ \ " >> $FILE
fi
done
echo "" >> $FILE
done
echo "" >> $FILE
echo "" >> $FILE
echo "" >> $FILE #spacer
#generate gaseous state of matter matrix
echo "Gas" >> $FILE
echo "" >> $FILE
echo "" >> $FILE
for (( j=0; j<8; j++))
do
for (( i=0; i<12; i++ ))
do
#gen random number
if [ $((RANDOM%5)) == 0 ]
then
echo $CIRCLE >> $FILE
echo "\ " >> $FILE
else
echo "\ \ " >> $FILE
fi
done
echo "" >> $FILE
echo "" >> $FILE
done
#turn the troff file into a PostScript file, then compile it into a PDF
groff $FILE > $FILENAME.ps && ps2pdf $FILENAME.ps
echo "Document complete!"
exit 1