Skip to content

Instantly share code, notes, and snippets.

@ThinGuy
Last active April 18, 2024 12:04
Show Gist options
  • Save ThinGuy/fea6a6f66e8c51a40c5322f3b4c560e8 to your computer and use it in GitHub Desktop.
Save ThinGuy/fea6a6f66e8c51a40c5322f3b4c560e8 to your computer and use it in GitHub Desktop.
Read a list of commands then make it look like you're typing in terminal, Use with termtosvg. asciinema, etc.
#!/bin/bash
[[ -f ~/script.cmds ]] || { printf "\nMissing $HOME/script.cmds. Exiting\n";exit 1; }
dprompt() { [[ $HOME = $(pwd) ]] && { local DIR='~'; } || { local DIR=$(pwd); };printf "\e[01;32m$USER@${HOSTNAME}\e[0m:\e[01;34m${DIR}\e[0m$ ";};export -f dprompt
clear
declare -ag DCMDS=()
export DCMD_CNT=${#DCMDS[@]}
while IFS= read -er C;do DCMDS+=("${C%;$*}");done < <(cat script.cmds)
export DCMD_CNT=${#DCMDS[@]}
for D in "${DCMDS[@]}";do dprompt;echo "${D}"|pv -qL 10;bash -c "${D}";done
canonical-livepatch status
canonical-livepatch status --verbose
canonical-livepatch status --verbose|awk '/fixes/,/tier:/{if (/CVE/) print;next}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment