请我需要帮助!这是我的第一个 bash 脚本,它在某些时候调用 python 脚本。但我总是在第 28 行和第 40 行得到这个输出:./startTests.sh: line 28: 'logs/tp1/load-test1-workloada.txt': No such file or directory目录logs/tp1确实存在!我认为这是我必须在那里使用的 char '>' 的东西,但我不知道如何修复它。这是我的脚本:#! /bin/bashecho -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 yesnoif [ $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'"
2 回答
狐的传说
TA贡献1804条经验 获得超3个赞
去掉双引号内的单引号。
> "'logs/tp${throughput}/load-test${test}-workloada.txt'"
在路径名中放入单引号,因为单引号在双引号内没有特殊含义。那应该是
> "logs/tp${throughput}/load-test${test}-workloada.txt"
您还可以在稍后的行中看到此内容:
> ""'logs/tp${throughput}/run-test${test}-workload${workload}.txt'"
这"
在开头有一个额外的内容,这使得报价不平衡。它应该是:
> "logs/tp${throughput}/run-test${test}-workload${workload}.txt"
添加回答
举报
0/150
提交
取消