bash - sed: using a variable for command and address -
bash - sed: using a variable for command and address -
while trying write bashscript on ubuntu came across next issue:
iconname="'application:\/\/nautilus.desktop'" echo "iconname: $iconname" sedvariable=\"s/$iconname[,]*//\" echo "sedvariable: $sedvariable" settings com.canonical.unity.launcher favorites | sed ${sedvariable}
i error saying "unknown command"
sed: -e ausdruck #1, zeichen 1: unbekannter befehl: `"'
however, variable "sedvariable" looks fine this:
sedvariable: "s/'application:\/\/nautilus.desktop'[,]*//"
when entering command manually works fine
gsettings com.canonical.unity.launcher favorites | sed "s/'application:\/\/nautilus.desktop'[,]*//"
why sed not take command variable? suggestion!
please seek this
sedvariable="-e s/$iconname[.]*//" gsettings com.canonical.unity.launcher favorites | sed "$sedvariable"
bash sed
Comments
Post a Comment