-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexemplo1.sh
More file actions
executable file
·57 lines (43 loc) · 1.15 KB
/
exemplo1.sh
File metadata and controls
executable file
·57 lines (43 loc) · 1.15 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
#exercício 1
'clear'
echo -e "exercício 1\nShell Script é demais!"
#exercício 2
var2="Shell Script com variáveis é demais!"
echo -e "\nxercício 2"
echo $var2
#exercício 3
hostname=`hostname`
echo -e "\nexercício 3\nEste script está rodando no computador: $hostname"
#exercício 4
echo -e "\nexercício 4"
caminho="/home/moacyr/Documentos/Trybe/1_5"
if [ -d $caminho ]
then
echo "O caminho $caminho está habilitado!"
if [ -w $caminho ]
then
echo "Você tem permissão para editar $caminho"
else
echo "Você NÃO foi autorizado a editar $caminho"
fi
else
echo -e "O caminho $caminho não está habilitado!"
fi
echo ""
#exercício 5
echo -e "exercício 5"
echo "Informe caminho de arquivo ou diretório "
read pergunta
if [ -f $pergunta ]
then
echo "$pergunta é um arquivo comum"
else
if [ -d $pergunta ]
then
echo "$pergunta é um diretorio"
ls -l /home/moacyr/Documentos/Trybe/1_5/$pergunta
else
echo "$pergunta é outro tipo de arquivo"
fi
fi