Estoy escribiendo un programa con algunos puntos de referencia aleatorios que mi hermano está pidiendo. Pero cuando terminé de escribirlo, lo probé y aquí está el resultado:
./benchmarksuite.sh: line 45: syntax error near unexpected token `}'
./benchmarksuite.sh: line 45: `}'
Entonces, ¿qué demonios está mal con mi código?
Aquí está el código:
#!/bin/bash
drivetest()
{
echo "How much data do you want to write (in MiB):"
read data
echo "Are you sure you want to perform a $data MiB write onto your disk?[Y/N]"
read confirm
if [ "$confirm" == "Y" ]; then
dd bs=1M count=$data if=/dev/zero of=test conv=fdatasync
elif [ "$verify" == "y" ]; then
dd bs=1M count=$data if=/dev/zero of=test conv=fdatasync
else
echo "Exiting the test."
fi
stresstest()
{
echo "How long is your stress(tips: Use letters along numbers like s,m,h. If you type number with OUT letter, default as second):"
read time
echo "How many CPU workers do you want?"
read cpu_worker
sudo stress --cpu $cpu_worker --timeout $time
echo ""
echo -e "${yellow}Thermal results:${res}"
sensors
}
random()
{
echo " MENU "
echo "Type 1 for a drive test. "
echo "Type 2 for a stress test. "
echo "Type 3 to perform all tests."
echo "Type other stuffs to exit. "
read value
if [ "$value" == "1" ]; then
drivetest
if [ "$value" == "2" ]; then
stresstest
if [ "$value" == "3" ]; then
{
drivetest
stresstest
}
}
yellow='\033[1;33m'
res='\033[0m'
echo -e "${yellow}Warning:${res}"
echo -e "${yellow}This script is depended on stress-ng and lm-sensors. Please be sure that you have those package installed.${res}"
echo "Verify [Y/N]:"
read verify
if [ "$verify" == "Y" ]; then
random
elif [ "$verify" == "y" ]; then
random
else
echo -e "${yellow}Please install the dependencies.${res}"
fi