我正在编写一个程序,其中包含我兄弟要求的一些随机基准。但是当我写完它时,我去测试它,结果如下:
./benchmarksuite.sh: line 45: syntax error near unexpected token `}'
./benchmarksuite.sh: line 45: `}'
Run Code Online (Sandbox Code Playgroud)
那么我的代码到底有什么问题呢?
这是代码:
#!/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." …Run Code Online (Sandbox Code Playgroud)