Skip to content

Instantly share code, notes, and snippets.

@toxeus
Created June 12, 2016 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toxeus/10d6949dbb328c8a7668c76f71b77a6c to your computer and use it in GitHub Desktop.
Save toxeus/10d6949dbb328c8a7668c76f71b77a6c to your computer and use it in GitHub Desktop.
How to create a interactive bash demo that does not need any typing.
#!/bin/bash
commands=(
"ls | head -n1"
"echo 44 55 | cut -d' ' -f1"
)
for c in "${commands[@]}"; do
read -p "\$ $c"
eval $c
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment