5 ms·
Just curious, how do you grep for foo in the middle of an alias like that? I usually use a function for something like this, or are you using alias colloquially
by ktm5j 3y ago
Just curious, how do you grep for foo in the middle of an alias like that? I usually use a function for something like this, or are you using alias colloquially?
- hiccuphippo 3y agoProbably a bash function rather than an alias.
- gumby 3y agoYeah, lazy imprecision on my part. A function in my .bashrc .
- ramses0 3y ago$ cat ~/bin/f #!/bin/bash if [ "$1" != "" ] ; then find . -type f | grep -v '\.git' | grep -i "$1" else find . -type f | grep -v '\.git' fi
- oxygen_crisis 3y agoPiping `find` through `grep` like that is inefficient, find has robust filtering capabilities you can use without the overhead of spawning subshells with pipes and calling another binary like grep. find . -type f -not -path '*/.git/*' -name "*$1*"
- ramses0 3y agoHrm... `f foo` vs. `.............................................foo..`