The aim is to put my command
aptitude search '?name(ABC)'
into the history list without executing it.
The existent means for this is
history -s XYZ
But what when the argument is the above command and addtionally has embedded double quotes.
My way in the momemt is to first replace in the command the single quotes with a chosen token, e.g.
SSSSquote
Then in my bash script to use these commands:
history -s 'aptitude search SSSSquote?name(ABC)SSSSquote'
fc -s SSSSquote=' -1 >/dev/null
Thus, after it is brougt into the history list, fc does alter the history line and replce the token SSSSquote back to single quotes.
The drawback is that fc executes the history line which it alters.
Do you know a general way without this drawback and for more complicated cases.
I am dreamimg up if perl could be involved with its quoting operators q().
Regards
antonhdidh