2

我在互联网上查看了很多答案,但没有任何解决方案有帮助。当我刚做open http://google.com时,我的默认浏览器是谷歌浏览器。我通过 brew 下载了 xdotool 包我想做的是,打开网页(任何网页)并每 10 秒刷新一次,我有以下代码:

#!/bin/bash
while true;
do
    export DISPLAY=:0.0
    export XAUTHORITY=/home/dogaister/.Xauthority
    open  http://google.com
    xdotool key command+r
    sleep 10
done

我也试过DISPLAY=':0'or DISPLAY=':0.0',他们也没有工作。

4

1 回答 1

4
#!/bin/bash
while true;
do
    osascript -e 'tell application "Google Chrome" to reload (tabs of window 1 whose URL contains "google.ca")'
    sleep 10
    echo "Reloaded"
done

工作。感谢 Mark Setchell 的贡献

于 2018-09-12T19:49:51.870 回答