I want to enable multiverse repository in Ubuntu by a command line.sed -i /^# deb.*multiverse/ s/^# // /etc/apt/sources.list && apt-get updateThis command will run apt-get update every time, but it's necessary only when sed comments the line out.Is there easy way to detect if sed replaces strings and run a command depending on that result?
How to run a command only if sed replace strings
sed
Probably the easiest thing to do here is just to grep for the commented line first:grep -q '^# deb.*multiverse' /etc/apt/sources.list &&  sed -i '/^# deb.*multiverse/ s/^# //' /etc/apt/sources.list &&  apt-get update