Linux Alias, what's wrong with it? -
Linux Alias, what's wrong with it? -
i've got alias:
alias gi='grep -r -i $1 ./*'
when
gi somestring
it grep, on other string provide, "p/ or other such thing in it.
i'm using similar grepping history:
alias gh='history | grep $1'
which works perfectly.
edit: on /bin/bash shell, per echo $shell.
thanks!
the alias
mechanism simply substitutes word. other words on same line left in place, typically 1 replaces command , leaves arguments. doesn't work grep illustration because want rearrange line.
now, $1
refer shell process (or shell function) parameters, in either case, not words typed on same line.
you improve served in case shell function, should work on posix shell including bash.
gi () { grep -r -i "$1" ./* }
linux alias
Comments
Post a Comment