Please I need help!
This is my first bash script, and it's calling a python script at some points. But I always get this output at line 28 and 40:
./startTests.sh: line 28: 'logs/tp1/load-test1-workloada.txt': No such file or directory
The directory logs/tp1 do exist ! I think it's something with the char '>' that I have to use there, but I don't know how to fix it.
This is my script:
#! /bin/bash
echo -e "\033[01;34m------------------------------"
echo -e "| Testes YCSB 0.17 |"
echo -e "------------------------------\033[01;37m"
echo -e 'Está rodando o script da raiz do YCSB? (y/n)'
read yesno
if [ $yesno = 'y' ]; then
echo -e 'Número de throughputs:'
read numOfThroughputs
echo -e 'Número de testes:'
read numOfTests
echo -e 'Iniciando...'
for ((throughput = 1; throughput <= $numOfThroughputs; throughput++)); do
echo -e '\033[01;32m------------------------------'
echo -e "Throughput $throughput "
echo -e '------------------------------\033[01;37m'
for ((test = 1; test <= $numOfTests; test++)); do
echo -e '\033[01;32m------------------------------'
echo -e "Iciando teste $test"
echo -e '------------------------------\033[01;37m'
echo -e 'Loading Workload A'
python ./bin/ycsb load mongodb-async -P workloads/workloada -p mongodb.url=mongodb://172.18.0.3:27017/ycsb?w=1 -P config/load.dat -s > "'logs/tp${throughput}/load-test${test}-workloada.txt'"
for workload in {a,b,c,,f,d,e}; do
if [ $workload = 'e' ]; then
echo -e "\033[01;33mPreparação para workload $workload"
echo -e "Apague o banco e precione QUALQUER TECLA 2X"
read enter
echo -e "Precione QUALQUER TECLA\033[01;37m"
read enter2
python ./bin/ycsb load mongodb-async -P workloads/workloade -p mongodb.url=mongodb://172.18.0.3:27017/ycsb?w=1 -P config/load.dat -s > "'logs/tp${throughput}/load-test${test}-workloade.txt'"
fi
echo -e "Workload $workload"
python ./bin/ycsb run mongodb-async -P workloads/workload"${workload}" -p mongodb.url=mongodb://172.18.0.3:27017/ycsb?w=1 -P config/runtp"${throughput}".dat -s > ""'logs/tp${throughput}/run-test${test}-workload${workload}.txt'"
done
echo -e "\033[01;32mTeste $test finalizado!"
echo -e "\033[01;33mApague o banco e precione QUALQUER TECLA 2X"
read enter
echo -e "Precione QUALQUER TECLA\033[01;37m"
read enter2
done
done
fi
Get rid of the single quotes inside double quotes.
> "'logs/tp${throughput}/load-test${test}-workloada.txt'"
is putting literal single quotes in the pathname, since single quotes have no special meaning inside double quotes. That should be
> "logs/tp${throughput}/load-test${test}-workloada.txt"
You also have this on a later line:
> ""'logs/tp${throughput}/run-test${test}-workload${workload}.txt'"
This has an extra "
at the beginning, which makes the quotes unbalanced. It should be:
> "logs/tp${throughput}/run-test${test}-workload${workload}.txt"
ogs/tp1 may be there but this is not same as 'logs/tp1/'. You should remove the single quotes.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.