I'm try to get sed to replace a line in /etc/lsb-release, I'm using the following code:
x=$( stdbuf -oL /bin/bash \-c '(sudo sed -i "s/DISTRIB_DESCRIPTION=.*/DISTRIB_DESCRIPTION=Linux Lite 2.4/g" /etc/lsb-release && echo "Linux Lite 2.4" | sudo tee /etc/llver && echo "Linux Lite 2.2 LTS \n \l" | sudo tee /etc/issue && sleep 2 )' 2>&1 |
stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p'|
zenity --progress --title="Updating version information..." --pulsate \
--width=600 --auto-close )
I have to use zenity as it is part of a large file. So I want the last line in /etc/lsb-release to show as:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Linux Lite 2.2"
with the existing code, it displays as:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION=Linux Lite 2.2
So I would like to preserve the quote marks around "Linux Lite 2.2"
Thank you :)
With
x=$( stdbuf -oL /bin/bash \-c '(sudo sed -i "s/DISTRIB_DESCRIPTION=.*/DISTRIB_DESCRIPTION=\"Linux Lite 2.4\"/g" /etc/lsb-release && echo "Linux Lite 2.4" | sudo tee /etc/llver && echo "Linux Lite 2.2 LTS \n \l" | sudo tee /etc/issue && sleep 2 )' 2>&1 |
stdbuf -oL sed -n -e '/\[*$/ s/^/# /p' -e '/\*$/ s/^/# /p'|
zenity --progress --title="Updating version information..." --pulsate \
--width=600 --auto-close )
Relevant bit:
# vv vv
'... "s/DISTRIB_DESCRIPTION=.*/DISTRIB_DESCRIPTION=\"Linux Lite 2.4\"/g" ...'