Skip to content

Instantly share code, notes, and snippets.

@shanenoi
Created August 19, 2020 13:42
Show Gist options
  • Save shanenoi/e9d0e7267f06cac8b5dfa1d2ace625ef to your computer and use it in GitHub Desktop.
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 🦛🐷🐮
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