Skip to content

Instantly share code, notes, and snippets.

@adamjstewart
Created December 20, 2019 17:39
Show Gist options
  • Save adamjstewart/1d377e92a224dfe2f12fabeb154586cf to your computer and use it in GitHub Desktop.
Save adamjstewart/1d377e92a224dfe2f12fabeb154586cf to your computer and use it in GitHub Desktop.
Primitive example of a self-aware program that passes the mirror test
#!/usr/bin/env bash
# Continuously kill processes
# Use Ctrl+C to exit
while true
do
read -p "kill " pid
if [[ "$pid" == $$ ]]
then
echo "I can't kill my own process!"
else
echo "Killing processing $pid..."
kill $pid
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment