Your example suggests that the variable is the search string. You could define a function:
s() {
grep -r -- "$1" /workplace/scripts /workplace/server
}
and invoke it by saying:
s "somestring"
Pregunta
I find myself running this command all the time
grep -r "somestring" /workplace/scripts /workplace/server
I would like to replace it with a simple custom command
s "somestring"
which will do the same thing.
how do I do this? I'm new to linux.
Solución
Your example suggests that the variable is the search string. You could define a function:
s() {
grep -r -- "$1" /workplace/scripts /workplace/server
}
and invoke it by saying:
s "somestring"