通知發送不顯示彈出訊息

通知發送不顯示彈出訊息

我有一個在某些條件下執行的腳本,每當我手動執行腳本,會出現彈出窗口,但是如果我嘗試自動執行腳本(即在系統從掛起狀態恢復後立即運行腳本),則不會出現彈出窗口,但腳本會執行其他任務。

這是我的腳本。

export DISPLAY=:0
#!/bin/bash
sleep 7s
echo "gotfile" $file1
lynx --dump link1 >> file1
lynx --dump link2 >> file1
lynx --dump link3 >> file1
grep "magnet:?xt=urn:btih:" file1 > file2
sed -i 's/^......//' file2
awk '/org%3A1337%2Fannounce/{print;print "";next}1' file2 >> file3
lines=$(wc -l < file3)
echo "no. of line $lines"
    if grep somepattern file3;
        then
            lineno=$(grep -n somepattern file3 | cut -d : -f 1)
            echo "current line no :-" $lineno
            link=$(head -n $lineno file3 | tail -1)
            echo $link
                notify-send -i /home/hasan/Desktop/flash/Flash.ico 'Flash is Running' 'Getting 3'
                notify-send -u critical 'Getting 3'
                transmission-remote -a $link
                echo $link >> flush
                echo "\n\n" >> flush

    fi

相關內容