Hello !
Kind of unexpected nightmare here. I run Dolibarr for my business, which is mainly a PHP website. I had to change some pieces of code for my own usage, and I'm shell-scripting (NO bash ! sh only) everything fo convenience (my script updates my Dolibarr to its latest version, and now I added in my script the pieces of code that it will update automatically since they'll be overwritten).
BUT... One line I have to change is very funny to handle. Here it is :
That's the original source line, and this is the one I'll get after updating my setup. There are both double quotes, single quotes and the asterisk. I need to search EXACTLY this line (using
I've been able to get most of the line by splitting the variable in two parts, playing ugly with single and double quotes :
It seems to work, but the asterisk will not. My shell script thinks I'm passing
Does anyone know a nice and clean way to fill this string into a variable, and make understand the script to keep the content as a string ?
Feel free to tell me if I'm doing it the wrong way, I don't pretend my method to be the good one. Thanks very much !!
Kind of unexpected nightmare here. I run Dolibarr for my business, which is mainly a PHP website. I had to change some pieces of code for my own usage, and I'm shell-scripting (NO bash ! sh only) everything fo convenience (my script updates my Dolibarr to its latest version, and now I added in my script the pieces of code that it will update automatically since they'll be overwritten).
BUT... One line I have to change is very funny to handle. Here it is :
Code:
dol_concatdesc($libelleproduitservice, " * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ? ' - ' : '').$subprodval[3]),
That's the original source line, and this is the one I'll get after updating my setup. There are both double quotes, single quotes and the asterisk. I need to search EXACTLY this line (using
sed) to make sure only this line will be edited. I can't base my edition on line number as it is expected there would be lines added or removed by devs. I'm storing this whole string into a variable I send to sed ( sed -i '.orig' -e 's!toriginal!replaced!g' $file).I've been able to get most of the line by splitting the variable in two parts, playing ugly with single and double quotes :
Code:
PDFLIB_L1674_1='dol_concatdesc($libelleproduitservice, " * "'
PDFLIB_L1674_2=".$subprodval[5].(($subprodval[5] && $subprodval[3]) ? ' - ' : '').$subprodval[3]),"
It seems to work, but the asterisk will not. My shell script thinks I'm passing
*, so it prints inside the variable the list of my current directory. This input variable is ugly, as I need to keep everything exactly as the original but I set my output variable with single quotes only (I don't know why the devs mixed them) and I can change the * with anything I want (it's used to print kind-of item point on the invoices).Does anyone know a nice and clean way to fill this string into a variable, and make understand the script to keep the content as a string ?
Feel free to tell me if I'm doing it the wrong way, I don't pretend my method to be the good one. Thanks very much !!