preexec() { if [[ $RANDOM == 1 ]] then echo "CONGRATULATIONS!" | lolcat echo "You are today's winner of the bash-lottery." | lolcat fi if [[ $1 == ls ]]; then echo "I'll show you..." fi if [[ $1 == time ]]; then echo "time for beer!" fi if [[ $1 == touch* ]]; then echo "No touching!" fi if [[ $1 == exit ]]; then echo "you're stuck here… FOREVAAAAAA" sleep 2 echo "just joking, do logout instead" shopt -s extdebug return 1 fi if [[ $1 == heyfriends ]]; then who | grep -Eo '^[^ ]+' shopt -s extdebug return 1 fi if [[ $1 == hello* ]]; then echo "Hi $USER! What's up?" | lolcat read mood if [[ $mood == *no* ]] then echo "Sorry to hear that, $USER. Anything I can do to help?" | lolcat read uselessanswer else echo "Glad to hear, keep up the good vibes!" | lolcat fi shopt -s extdebug #stops "hello" from executing, which would give a "command not found" error. return 1 fi if [[ $1 == *apt-get* ]]; then echo "Thank you $USER for your maintenance efforts! Our community really appreciates it" | lolcat fi if [[ $1 == guide* ]]; then split=($1) echo ${split[1]} man ./guides/${split[1]}.1 shopt -s extdebug return 1 fi if [[ $1 == ssh* ]]; then if [[ $(( ( RANDOM % 10 ) + 1 )) == 1 ]] then echo "Not today, maybe later..." | lolcat shopt -s extdebug return 1 fi fi if [[ $1 == *adduser* ]]; then inputcommand=($1) echo "What is your preferred pronoun?" | lolcat read answer if [[ $answer ]] then echo $answer > ${inputcommand[2]}pronoun.txt fi sudo adduser ${inputcommand[2]} sudo mv ${inputcommand[2]}pronoun.txt /home/${inputcommand[2]}/pronoun.txt shopt -s extdebug return 1 fi if [[ $1 == *reroaming* ]]; then argument=($1) if [[ ${argument[1]} == howto ]]; then man ./guides/howto.1 fi if [[ ${argument[1]} == guide ]]; then sed '/__PUBLISH__/d' ./guides/guide | fold | lolcat fi if [[ ${argument[1]} == why ]]; then man ./guides/why.1 fi shopt -s extdebug return 1 fi if [[ -e "tellme.txt" && $1 == *"tellme"* ]] then name="name called title" what="info explain folder what" why="why because" how="how instructions use" when="when time past history" who="who author creator owner user" tell () { if [[ ${@:0:1} == "@" ]] then eval ${@:1:-1} else echo "$@" | pv -qL 128 echo " " fi } captured_command=0 for per_word in $1; do if [[ $name == *"$per_word"* ]] then tell $(grep -A 2 '#name' "tellme.txt" | grep -v "#name") captured_command=1 break elif [[ $what == *"$per_word"* ]] then tell $(grep -A 2 '#what' "tellme.txt" | grep -v "#what") captured_command=1 break elif [[ $why == *"$per_word"* ]] then tell $(grep -A 2 '#why' "tellme.txt" | grep -v "#why") captured_command=1 break elif [[ $how == *"$per_word"* ]] then tell $(grep -A 2 '#how' "tellme.txt" | grep -v "#how") captured_command=1 break elif [[ $when == *"$per_word"* ]] then tell $(grep -A 2 '#when' "tellme.txt" | grep -v "#when") captured_command=1 break elif [[ $who == *"$per_word"* ]] then tell $(grep -A 2 '#who' "tellme.txt" | grep -v "#who") captured_command=1 break fi done if [[ $captured_command == 1 ]] then shopt -s extdebug return 1 fi fi if [[ $1 == *"explainthis"* ]] then tell () { if [[ ${@:0:1} == "@" ]] then eval ${@:1:-1} else echo " " echo "$@" | pv -qL 128 echo " " fi } tell "Thanks for taking the time to explain your work! I will ask you some questions about what you've done. You are free to leave questions unanswered." tell "What is your project or folder called?" read new_name tell "How would you describe your work in a short sentence?" read new_what tell "What's your name or nickname?" read new_who tell "When did you create this work?" read new_when tell "Why did you create this work?" read new_why tell "How did you create this work?" read new_how tell "Thanks, I'll document it! You can use the tellme command (tellme how, tellme why, etc) to query other folders." > tellme.txt echo "#name" >> tellme.txt echo $new_name >> tellme.txt echo " " >> tellme.txt echo "#who" >> tellme.txt echo $new_who >> tellme.txt echo " " >> tellme.txt echo "#what" >> tellme.txt echo $new_what >> tellme.txt echo " " >> tellme.txt echo "#when" >> tellme.txt echo $new_when >> tellme.txt echo " " >> tellme.txt echo "#why" >> tellme.txt echo $new_why >> tellme.txt echo " " >> tellme.txt echo "#how" >> tellme.txt echo $new_how >> tellme.txt echo " " >> tellme.txt shopt -s extdebug return 1 fi if [[ $1 == tour ]]; then echo "hello $USER, welcome to the filesystem tour" | lolcat echo "" echo '/\/\/\/\/\/\/\/\/\/\' | lolcat | pv -qL 8 echo "" echo 'FIRST STOP!' | lolcat cd ~ echo "This directory is your home directory. Cozy, isn't it?" | lolcat sleep 1 echo "here's a picture of the landscape" | lolcat echo "" ls -la | lolcat echo "" shopt -s extdebug return 1 fi if [[ $1 == whereami ]]; then echo "you are here, don't get lost :)" pwd shopt -s extdebug fi }