CJmonk has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to make a command history file for my software CJ. So, I would like to get the exact command given to bash on a terminal including the quotation marks, and so on.
For instance, consider$ perl CJ.pl run example_reduce.m sherlock -mem 8G -m "this is a test"
currently, I am doing$cmdline = `ps -o args $$ | grep CJ.pl`;
to get the command, but the problem is bash interprets and the quotation marks are gone. So I get (in the history file I am trying to make)As you see, the quotes are deleted. The reason I need the exact command is to rerun this line of history using another routine I built. Namely, when I write12 perl CJ.pl run example_reduce.m sherlock -mem 8G -m this is a test
I expect to reissue command number 12. But because of the deleted quotes on the message (-m option), it generates error!... Does anyone know how I can read the command as is! I have searched a lot on google, but wasn't successful in finding something clean that actually works!perl CJ.pl @12
Best,
CJmonk
|
|---|