我需要创建一个bash脚本来等待创建文件.该脚本将在while循环中使用sleep命令,每10秒定期检查一个文件.等待时打印留言.创建文件后显示文件的内容.以下是我试图实现的内容,但显然无效.在这一点上,我不完全确定如何继续.
#!/bin/bash
let file=$1
while '( -f ! /tmp/$1)'
do
sleep 10
echo "still waiting"
done
echo "Content of the file $1:"
Run Code Online (Sandbox Code Playgroud)