Me ajudem com este BUG

1. Me ajudem com este BUG

Anderson Cortez Calderini
Ydna

(usa Outra)

Enviado em 31/07/2019 - 01:56h

Eu escrevi um código:

#bin/bash!
####################################
## BASH EXCT ##
## ##
## LAST UPDATE: 2019-07-30-23:38 ##
## VERSION: 2.0.0 ##
## CREATOR: Nico Perez ##
####################################
echo "Enter Imput:"
read imput
sair=0
while [ $sair = 0 ];
do
while [ $imput = "1397" ];
do
echo "Shell Exct [VER: 1.0.0] for Kali Linux"
echo "Type help to get help"
read comando
if [ $comando = "help" ];
then
echo "Commands":
echo ""
echo "Help - Get a list of all the commands of Shell Exct"
echo "Erase - Clear the screen"
echo "Rd - Remove a directory/folder"
echo "Cd - Create a directory/folder"
echo "Ed - Enter in a directory/folder"
echo "Quit - Close the program"
fi
if [ $comando = "erase" ];
then
clear
fi
if [ $comando = "rd" ];
then
echo "Type the name of the directory you want to delete"
read directory
rmdir $directory
fi
if [ $comando = "cd" ];
then
echo "Type the name of the directory you want to create"
read directory
mkdir $directory
fi
if [ $comando = "quit" ];
then
exit
fi
if [ $comando = "ed" ];
then
echo "Type the name of the directory you want to enter"
read directory
cd $directory
fi
done
echo "Wrong Password"
sair=1
done


A ideia era criar um terminal que facilitasse as funções do terminal comum. Porém, por algum motivo, na hora que eu peço para o Bash rodar o meu programa, ele dá um grupo escrito "line 10: `read imput': not a valid identifier". Alguém pode me explicar o motivo?


  


2. Re: Me ajudem com este BUG

Matheus
pylm

(usa Gentoo)

Enviado em 31/07/2019 - 10:50h

Funciona aqui mas todas as opções estão quebradas.


pylm@inspiron ~ $ ./script
Enter Imput:
1397
Shell Exct [VER: 1.0.0] for Kali Linux
Type help to get help
help
Commands:

Help - Get a list of all the commands of Shell Exct
Erase - Clear the screen
Rd - Remove a directory/folder
Cd - Create a directory/folder
Ed - Enter in a directory/folder
Quit - Close the program
Shell Exct [VER: 1.0.0] for Kali Linux
Type help to get help
Ed Downloads
./basher: linha 20: [: número excessivo de argumentos
./basher: linha 31: [: número excessivo de argumentos
./basher: linha 35: [: número excessivo de argumentos
./basher: linha 41: [: número excessivo de argumentos
./basher: linha 47: [: número excessivo de argumentos
./basher: linha 51: [: número excessivo de argumentos
Shell Exct [VER: 1.0.0] for Kali Linux
Type help to get help



Ele também não encerra no comando Quit.
PS: Imput é com n.


3. Re: Me ajudem com este BUG

Marcelo Oliver
msoliver

(usa Debian)

Enviado em 31/07/2019 - 17:39h


Ydna escreveu:

Eu escrevi um código:

#bin/bash!
####################################
## BASH EXCT ##
## ##
## LAST UPDATE: 2019-07-30-23:38 ##
## VERSION: 2.0.0 ##
## CREATOR: Nico Perez ##
####################################
echo "Enter Imput:"
read imput
sair=0
while [ $sair = 0 ];
do
while [ $imput = "1397" ];
do
echo "Shell Exct [VER: 1.0.0] for Kali Linux"
echo "Type help to get help"
read comando
if [ $comando = "help" ];
then
echo "Commands":
echo ""
echo "Help - Get a list of all the commands of Shell Exct"
echo "Erase - Clear the screen"
echo "Rd - Remove a directory/folder"
echo "Cd - Create a directory/folder"
echo "Ed - Enter in a directory/folder"
echo "Quit - Close the program"
fi
if [ $comando = "erase" ];
then
clear
fi
if [ $comando = "rd" ];
then
echo "Type the name of the directory you want to delete"
read directory
rmdir $directory
fi
if [ $comando = "cd" ];
then
echo "Type the name of the directory you want to create"
read directory
mkdir $directory
fi
if [ $comando = "quit" ];
then
exit
fi
if [ $comando = "ed" ];
then
echo "Type the name of the directory you want to enter"
read directory
cd $directory
fi
done
echo "Wrong Password"
sair=1
done
A ideia era criar um terminal que facilitasse as funções do terminal comum. Porém, por algum motivo, na hora que eu peço para o Bash rodar o meu programa, ele dá um grupo escrito "line 10: `read imput': not a valid identifier". Alguém pode me explicar o motivo?

Boa tarde, segue sugestão:
#bin/bash!
VERSION="2.0.1"

PASSWORD(){
read -p " Enter keyword: " keyword;
[[ ${keyword} -ne $(base64 -d <<< "MTM5Nw==") ]] && { echo -e "\n Wrong Password\n Exit . . .\n"; exit 0; }
}

help(){
clear;
echo -e " Commands:
\"Erase\" - Clear the screen.
\"Rd\" - Remove a directory/folder.
\"Cd\" - Create a directory/folder.
\"Ed\" - Enter in a directory/folder.
\"ls\" - List files of current directory.
\"pwd\" - Show name of current directory.
\"cal\" - Show the calendar of Current month.
\"ver\" - Show version of program.
\"Quit\" - Close the program\n"
}

READ(){ read -p " Type the name of the directory you want to $1: " directory; }

line() { printf '%*s' "40" '' | sed "s/ /-/g";}

clear;PASSWORD;

while :;do
printf " $(line)\n Type help to get help.\n $(line)\n"
read -p " Command: " cmd;cmd=${cmd^^};
case $cmd in
HELP) help ;;
ERASE) clear;;
RD) READ delete;rmdir $directory;;
CD) READ create;mkdir $directory;;
ED) READ enter;cd $directory;;
LS) ls -l;;
PWD) echo -e "\n The name of current directory is: $(pwd)\n";;
VER) echo -e "\n Version of program is: [${VERSION}].\n";;
CAL) echo -e "\n$(cal)";;
QUIT) echo -e "\n Exit . . . \n";break;;
*) echo -e " Invalid option.\n"
esac
done

Importante => echo -e "$(lynx --dump goo.gl/a9KeFc|sed -nr '/^[ ]+Se/,/dou.$/p')"
Att.: Marcelo Oliver






Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts