-
-
Save wesleyleite/5f74ceea5d3c89096aeeb660fc77b1a4 to your computer and use it in GitHub Desktop.
A minimalist shell skeleton
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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