Skip to content

Commit 60d7f5c

Browse files
committed
melhoria de codigo
1 parent 774d6b2 commit 60d7f5c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

projeto/src/insSSH

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function ssh_install ()
2-
{
2+
{
33
if dpkg -l | grep openssh-server &> /dev/null
44
then
55
echo " Servidor ssh ja esta instalado";
@@ -56,7 +56,7 @@ function ssh_install ()
5656

5757
echo -n " Digite a porta entre 1 e 65535 ( padrão 22 ): ";
5858
read port;
59-
while [ $port -lt 0 -o $port -gt 65535 ]
59+
while echo $port | egrep '[^0-9]' &> /dev/null || [ $port -lt 0 -o $port -gt 65535 ]
6060
do
6161
{
6262
echo -n " Parâmetro incorreto. Digite novamente: ";
@@ -69,7 +69,7 @@ function ssh_install ()
6969

7070
echo -n " Digite o intervalo de atualização da chave ( em segundos ): ";
7171
read time;
72-
while [ $time -lt 0 ]
72+
while echo $time | egrep '[^0-9]' &> /dev/null || [ $time -lt 0 ]
7373
do
7474
{
7575
echo -n " Parâmetro incorreto. Digite novamente: ";
@@ -79,7 +79,7 @@ function ssh_install ()
7979

8080
echo -n " Digite o tamanho da chave ( 1024 é o padrão ): ";
8181
read key;
82-
while [ $key -lt 0 ]
82+
while echo $key | egrep '[^0-9]' &> /dev/null || [ $key -lt 0 ]
8383
do
8484
{
8585
echo -n " Parâmetro incorreto. Digite novamente: ";

0 commit comments

Comments
 (0)