Это должно обеспечить то, что требуется:
grep -q "oldstring" test.txt
if [ $? -eq 1 ]; then
echo "newstring" >> test.txt
else
sed -i 's/oldstring/newstring/g' test.txt
fi
Вам понадобится dbus-monitor
Скрипт будет выглядеть как
#!/bin/bash
interface=org.gnome.Rhythmbox.Player
member=playingUriChanged
# listen for playingUriChanged DBus events,
# each time we enter the loop, we just got an event
# so handle the event, e.g. by printing the artist and title
# see rhythmbox-client --print-playing-format for more output options
dbus-monitor --profile "interface='$interface',member='$member'" |
while read -r line; do
printf "Now playing: "
rhythmbox-client --print-playing
done
Взято из https://stackoverflow.com/a/5345462/854477
Вам понадобится dbus-monitor
Скрипт будет выглядеть как
#!/bin/bash
interface=org.gnome.Rhythmbox.Player
member=playingUriChanged
# listen for playingUriChanged DBus events,
# each time we enter the loop, we just got an event
# so handle the event, e.g. by printing the artist and title
# see rhythmbox-client --print-playing-format for more output options
dbus-monitor --profile "interface='$interface',member='$member'" |
while read -r line; do
printf "Now playing: "
rhythmbox-client --print-playing
done
Взято из https://stackoverflow.com/a/5345462/854477
Вам нужен dbus-monitor
. Скрипт будет выглядеть примерно как
#!/bin/bash
interface=org.gnome.Rhythmbox.Player
member=playingUriChanged
# listen for playingUriChanged DBus events,
# each time we enter the loop, we just got an event
# so handle the event, e.g. by printing the artist and title
# see rhythmbox-client --print-playing-format for more output options
dbus-monitor --profile "interface='$interface',member='$member'" |
while read -r line; do
printf "Now playing: "
rhythmbox-client --print-playing
done
Вам нужен dbus-monitor
. Скрипт будет выглядеть примерно как
#!/bin/bash
interface=org.gnome.Rhythmbox.Player
member=playingUriChanged
# listen for playingUriChanged DBus events,
# each time we enter the loop, we just got an event
# so handle the event, e.g. by printing the artist and title
# see rhythmbox-client --print-playing-format for more output options
dbus-monitor --profile "interface='$interface',member='$member'" |
while read -r line; do
printf "Now playing: "
rhythmbox-client --print-playing
done
Вам нужен dbus-monitor
. Скрипт будет выглядеть примерно как
#!/bin/bash
interface=org.gnome.Rhythmbox.Player
member=playingUriChanged
# listen for playingUriChanged DBus events,
# each time we enter the loop, we just got an event
# so handle the event, e.g. by printing the artist and title
# see rhythmbox-client --print-playing-format for more output options
dbus-monitor --profile "interface='$interface',member='$member'" |
while read -r line; do
printf "Now playing: "
rhythmbox-client --print-playing
done
Вам нужен dbus-monitor
. Скрипт будет выглядеть примерно как
#!/bin/bash
interface=org.gnome.Rhythmbox.Player
member=playingUriChanged
# listen for playingUriChanged DBus events,
# each time we enter the loop, we just got an event
# so handle the event, e.g. by printing the artist and title
# see rhythmbox-client --print-playing-format for more output options
dbus-monitor --profile "interface='$interface',member='$member'" |
while read -r line; do
printf "Now playing: "
rhythmbox-client --print-playing
done
Вам нужен dbus-monitor
. Скрипт будет выглядеть примерно как
#!/bin/bash
interface=org.gnome.Rhythmbox.Player
member=playingUriChanged
# listen for playingUriChanged DBus events,
# each time we enter the loop, we just got an event
# so handle the event, e.g. by printing the artist and title
# see rhythmbox-client --print-playing-format for more output options
dbus-monitor --profile "interface='$interface',member='$member'" |
while read -r line; do
printf "Now playing: "
rhythmbox-client --print-playing
done
Вам нужен dbus-monitor
. Скрипт будет выглядеть примерно как
#!/bin/bash
interface=org.gnome.Rhythmbox.Player
member=playingUriChanged
# listen for playingUriChanged DBus events,
# each time we enter the loop, we just got an event
# so handle the event, e.g. by printing the artist and title
# see rhythmbox-client --print-playing-format for more output options
dbus-monitor --profile "interface='$interface',member='$member'" |
while read -r line; do
printf "Now playing: "
rhythmbox-client --print-playing
done
Вам нужен dbus-monitor
. Скрипт будет выглядеть примерно как
#!/bin/bash
interface=org.gnome.Rhythmbox.Player
member=playingUriChanged
# listen for playingUriChanged DBus events,
# each time we enter the loop, we just got an event
# so handle the event, e.g. by printing the artist and title
# see rhythmbox-client --print-playing-format for more output options
dbus-monitor --profile "interface='$interface',member='$member'" |
while read -r line; do
printf "Now playing: "
rhythmbox-client --print-playing
done