Hello!
I am making an automated script to install a certain Windows application via Wine. Because the application itself always runs in full screen mode which results in Wine crashing it needs to be run in a Virtual Desktop.. I'm trying to achieve that by seding the .desktop file... however I can't find the problem to why this won't work:
sed -i "s/env WINEPREFIX=\"$HOME\/.wine\" wine/env WINEPREFIX=\"$HOME\/.wine\" wine explorer \/desktop=\"Wine\",800x600/ $(\/usr\/local\/bin\/fconv --init \"$HOME\/FabiusConv\/\")" "$HOME/Desktop/FabiusConv.desktop"
Thanks in advance!
NOTE: The script should be portable and that's why I need to use a double-quote instead of a singe-quote to be able to use the $HOME variable and the $(\/usr\/local\/bin\/fconv --init \"$HOME\/FabiusConv\/\") command.
Thanks in advance!
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
Sed unknown option to s
Firstly, you can avoid having to escape the forward slashes if you use a different delimiter:
Secondly, are you searching and replacing the literal string '$HOME' or its expanded form?
e.g. say that the file FabiusConv.desktop contains these two lines:
Then this will find and replace the first line:
And this will find and replace the second line - (just leave the $HOME variable outside the single-quotes so that the shell can expand it):
Thirdly, if you're not yet sure that a sed script is going to do what you want then it's a bad idea to use the edit-in-place '-i' option; even when you've perfected the script it's good to keep a backup with 'sed -i.bak ...'
Code: Select all
sed 's_/this/is/a/path_/this/is/the/replacement/path_'
e.g. say that the file FabiusConv.desktop contains these two lines:
Code: Select all
env WINEPREFIX=$HOME/.wine wine
env WINEPREFIX=/home/freddy/.wine wine # or whatever your user name is instead of 'freddy'
Code: Select all
sed -i.bak 's_env WINEPREFIX=$HOME/.wine wine_env WINEPREFIX=$HOME/.wine wine explorer /desktop=Wine,800x600_' $HOME/Desktop/FabiusConv.desktop
Code: Select all
sed -i.bak 's_env WINEPREFIX='$HOME'/.wine wine_env WINEPREFIX='$HOME'/.wine wine explorer /desktop=Wine,800x600_' $HOME/Desktop/FabiusConv.desktop