Skip to content

Instantly share code, notes, and snippets.

@wesleyleite
Forked from merces/minibash.sh
Last active August 11, 2016 21:58
Show Gist options
  • Save wesleyleite/5f74ceea5d3c89096aeeb660fc77b1a4 to your computer and use it in GitHub Desktop.
Save wesleyleite/5f74ceea5d3c89096aeeb660fc77b1a4 to your computer and use it in GitHub Desktop.
A minimalist shell skeleton
#!/bin/bash
declare -a comandos
comandos=('listar'\
'sair')
echo "bemvindo ao minibash
use TAB para ver comandos disponiveis"
set -o vi
bind 'TAB:dynamic-complete-history'
history -s "${comandos[@]}"
while :; do
read -e -p '$ ' cmd
case $cmd in
listar)
ls ;;
sair)
exit ;;
'')
continue ;;
*)
echo $cmd: comando invalido ;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment