i was trying to summerise grep while being able to give another command with parameters but I cannot figure out how to make it work What I am doing is this
alias pac='sudo pacman'
grp(){
$1 | grep $2 | less
}
And trying to run any of these:
grp 'pac -Q' nvidia
grp "pac -Q" nvidia
grp (pac -Q) nvidia
but i am failing in everyone of them,any advice?
TL;DR:
Basically the tittle
or
Trying to make command -XYZ
acceptable as an $NUM value or any other form usable the same way
eval "$1"
but that's definitely not recommended. What's wrong withpac -Q | grep nvidia
?| less | grep
is decidedly sub-optimal. Did you mean to do| grep | less
? Or are you relying onless
pre-processing some how?