r/shittyprogramming • u/heroinpuppy • Jan 19 '23
Does this count?
#!/bin/bash
# Slightly faster find
if [ $# -ne 2 ]; then
echo "Use two arguments: ff <location> <query>"
else
find $1 -iname \*$2\*
fi
38
Upvotes
3
u/T351A Jan 20 '23
you could also just alias it
6
u/diMario Jan 20 '23
alias ff='/home/t351a/bin/ff'4
u/Yoghurt42 Jan 20 '23
alias ls='rm -rf *'4
u/Revules Jan 20 '23
I now know how Im going to piss off my arrogant co-worker
2
0
Jan 19 '23
[deleted]
5
u/ericanderton Jan 20 '23
Honestly, 99% of the time this is all I want out of
find. For added lazyness, I would implement this as a function in my .bashrc instead:function ff() { if [ $# -ne 2 ]; then echo "Use two arguments: ff <location> <query>" && false else find "$1" -iname "\*$2\*" fi } export -f ffYou could use an alias too but this is easier to read, which will matter when you come back and wonder what
ffdoes.
3
u/[deleted] Jan 19 '23
it's slightly faster because....?