Sometimes you need the input exactly as written - for example if you want to be able to tell the difference between
bar
and b"a"r
.
The following is a workaround/hack to retrieve the full command that executed your script.
Rename your script to add a leading underscore to it. For example, foo
becomes _foo
.
Create an alias in your ~/.bash_rc
or /etc/profile
replacing %NAME%
with the name of your script:
alias %NAME%='function _pass(){ echo `history 1` | grep -o '%NAME%.*' | _%NAME%; }; _pass'
Example:
alias foo='function _pass(){ echo `history 1` | grep -o 'foo.*' | _foo; }; _pass'
Now your script receives the whole command line that it was called from!