Created
August 19, 2020 13:42
-
-
Save shanenoi/e9d0e7267f06cac8b5dfa1d2ace625ef to your computer and use it in GitHub Desktop.
Tại sao lại phải install Mlocate 🦧 trong khi chúng ta có thể code được chức năng chính của nó 🤯 Tốc độ thì không gọi là quá chậm 🦛🐷🐮
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update_data () { | |
printf "[+] Update Data, Please Wait!\n" | |
rm ~/..locate_* | |
sudo find />~/..locate_$(date +%s) 2>/dev/null | |
exit 0 | |
} | |
if [ "$1" = "--update" ]; | |
then | |
update_data | |
else | |
if [ "$(($(date +%s)-$(ls ~/..locate_* | grep -Po [^_]+$)))" -gt "3600" ]; | |
then | |
update_data | |
else | |
# search | |
grep --color=auto -P $1 ~/..locate_* | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment