-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc8e1
More file actions
42 lines (37 loc) · 938 Bytes
/
c8e1
File metadata and controls
42 lines (37 loc) · 938 Bytes
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
37
38
39
40
41
42
#! /bin/bash
#
# Capitulo 8 - Exercicio 1
#
Erro () # # # Este nome eh porque a funcao pode ser usada para erros de critica
{
if [ "$#" -lt 2 -o \( "$#" -gt 3 \) ]
then
echo "Uso: $0 <Mensagem> <No. Linha> [ <No. Coluna> ]"
exit 1
fi
if [ "$#" -eq 3 ]
then
C=$3
else
Len=`expr length "$1"`
C=`expr "(" 80 - "$Len" ")" / 2`
fi
tput cup $2 $C
echo "$1\07\c"
read a < /dev/tty
tput cup $2 $C
echo " "
return
}
# Inicio do bacalho
clear
if [ "$#" -ge 2 -a \( "$#" -le 3 \) ]
then
Mens=$1
shift 1
Erro "$Mens" $* ## Se $Mens nao estiver entre aspas, dara zebra. Porque??
else
Erro "Estou passando a mensagem, a linha e a coluna" 21 20
Erro "Estou passando a mensagem e a linha sem a coluna" 21
Erro "Estou passando soh a mensagem"
fi