It looks like you have an extra pair of single quote characters around your filename that need to be stripped off.
Here, I have a file named "hello":
$ ls
hello
Trying to delete it with extra single quotes like this:
$ rm "'hello'"
gives exactly the error message you see:
rm: cannot remove `\'hello\'': No such file or directory
the \'
before and after the name are single quotes you need to strip off.
EDIT:
In your case (as another answerer has noted) the output of
gsettings get org.gnome.desktop.background picture-uri
returns a result like:
'file:///usr/share/backgrounds/Tie_My_Boat_by_Ray_Garc%C3%ADa.jpg'
So you want to strip the leading 'file://
and the ending '
. This can be done correctly using sed
like this (using only one expression with a group)
sed -e "s|^'file://\(.*\)'$|\1|g"
or maybe easier to read (using two simple expressions)
sed -e "s|^'file://||g" -e "s|'$||"
Please note:
^
matches the beginning of the line
$
matches the end of the line.
- any character can be used in
sed
to surround the search and replace expressions. Normally, you would use /
but in this case it is easier to use something else, so I use |
.