dev/bash/pidgin_status/pidgin_ch_status.sh

28 lines
702 B
Bash
Executable File

#!/bin/bash
happy=1295818033
bored=1295818107
status=${!1}
# неопределённый статус
if [[ "$status" == "" ]]; then
exit 0
fi
#echo $status
killall pidgin
xml_str=`xpath ~/.purple/prefs.xml "//pref/pref/pref[@name='savedstatus']/pref[@name='default'" 2>/dev/null`
new_xml_str=`echo $xml_str |sed ~s~[0-9][0-9]*~$status~`
xml_str=`echo $xml_str|sed 's/</\\\</ ; s/>/\\\>/ ; s/\"/\"/g ; s/\=/\\\=/g ; ~s~/~\\\/~'`
new_xml_str=`echo $new_xml_str|sed 's/</\\\</ ; s/>/\\\>/ ; s/\"/\"/g ; s/\"/\\\"/g ; s/\=/\\\=/g ; ~s~/~\\\/~'`
echo "$xml_str"
#echo "$new_xml_str"
grep $xml_str ~/.purple/prefs.xml
#sed -i ~/.purple/prefs.xml "s/$xml_str/$new_xml_str/"
#(pidgin &>/dev/null)&