in reply to [SHELL] Detect backslash in command line args
As others have mentioned, osx/linux strips the command line before passing the arguments to perl, and so I don't know of any way that perl could "see" the unprocessed arguments.
bash has handy tools that can retrive historical command line arguments. The catch as I see it is that while ~/.bash_history is fully available to your perl script, and contains the unprocessed command line arguments, it only updates when you log out of the shell, and so won't contain the last command issued.
bash does keep a record of unprocessed command lines in working memory. These can be printed at the command line for example with:
history | tail -5
where the last digit determines the number of previous commands to print at the terminal. These are also unprocessed. The problem is that the history command isn't a bash executable, and so doesn't work in the context of a system() call by Perl. Maybe someone knows how to get around this? Would be interested to find the answer.
Michael
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: [SHELL] Detect backslash in command line args
by syphilis (Archbishop) on Jul 09, 2013 at 00:19 UTC | |
by mtmcc (Hermit) on Jul 09, 2013 at 07:07 UTC |