enemesis Posted February 4, 2014 Posted February 4, 2014 (edited) Recherche par index of (thanks to google) #!/bin/bash # /*** Function ***/ function usage(){ echo -e "Utilisation :" echo -e " $0 [OPTION] [MOTIF...] Script de recherche par index of\n" echo -e "Option :" echo -e " -h, --help \t\t Affiche ce message" echo -e " -a, --all \t\t Obtenir tous les liens (doc/image/music/video)" echo -e " -d, --doc \t\t Rechercher que les documents ou les images" echo -e " -m, --music \t\t Rechercher que les musiques" echo -e " -v, --video \t\t Rechercher que les vidéos\n" echo -e "Exemple de motif :" echo -e " mot \t\t\t Rechercher un simple mot" echo -e " mot+mot \t\t Rechercher plusieurs mots" echo -e ' '"mot composé"' \t Rechercher un mot composé\n' } function docLink(){ echo -e "Documents et images : \n"$url$var"+\"(pdf|jpg|png|bmp)\"\n" } function musicLink(){ echo -e "Musiques : \n"$url$var"+\"(mp3|wav|flac|ogg)\"\n" } function videoLink(){ echo -e "Films : \n"$url$var"+\"(avi|mkv)\"\n" } # /*** Main ***/ if [ $# -eq 0 ] then usage exit 0 fi url='https://www.google.fr/search?q=intitle%3A"index+of"+-inurl%3A"index"+-inurl%3A"html"+-inurl%3A"php"+-inurl%3A"asp"+"name"+"last+modified"+"size"+-ch0c+-c.ocori.co+intext%3A' case "$1" in -h|--help) usage; exit 0;; -a|--all) var=$2; docLink; musicLink; videoLink; exit 0;; -d|--doc) var=$2; docLink; exit 0;; -m|--music) var=$2; musicLink; exit 0;; -v|--video) var=$2; videoLink; exit 0;; -*) echo -e "$0: Option inconnu $1\n" usage; exit 0;; *) var=$1; docLink; musicLink; videoLink; exit 0;; esac exit 0 Fonctionnement : bash google.sh "ma_recherche" PS : Vous pouvez bien évidement l'améliorer. Edited February 10, 2014 by insomniaque
Nikos Posted February 10, 2014 Posted February 10, 2014 Ce genre de truc c'est direct avec un alias dans le .bashrc
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now