-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmsg-help.sh
36 lines (31 loc) · 908 Bytes
/
msg-help.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/bash
# Muito útil para a criação de programas grandes que necessitam
# informação aplicada em argumentos através do bash
# Ex: ./programa.sh -h/--help [Exibe a função '_Ajuda_']
# Ex: ./programa.sh -v/--version [Exibe a variável 'versao']
argumento1="$1"
versao='1.0'
_Ajuda_(){
printf "\
\nNAME\n \
\t$0 - Exemplo de texto\n \
\nSYNOPSIS\n \
\t$0 [Ex1] [Ex2]\n \
\nDescrição\n \
\tO $0 é usado para demonstrar o exemplo\n \
\tMais exemplos\n \
\nOpções\n \
\t-h, --help\n \
\t\tMostra como usar o programa\n\n \
\t-f,--file\n \
\t\tProcura um arquivo\n\n \
\t\tEx: $0 -f file.txt\n\n"
}
case $argumento1 in
"-v"|"--version") printf "\nVersion: $versao"
exit 0
;;
"-h"|"--help") _Ajuda_
exit 0
;;
esac