在执行Linux shell脚本时等待消息

问题描述 投票:-4回答:1

在我的shell脚本中,输出需要3-4分钟。我想展示一些等待消息,直到那个时候像wait for output....

linux bash shell scripting
1个回答
1
投票
echo -n "Wait for output.."
script > outputfile &
pid=$!
while ps $pid > /dev/null 2>/dev/null ; do
    echo -n .
    sleep 10
done
echo .
echo "And here is that output you've been waiting for:"
cat outputfile
© www.soinside.com 2019 - 2024. All rights reserved.