• # Ou alors...

    Posté par . En réponse au message Insérer une variable dans un lien sur shell. Évalué à 3. Dernière modification le 16 janvier 2019 à 22:59.

    En récupérant le nom du premier fichier à télécharger dans la page web :
    http://dreamosat.net/oscam/index.php?&direction=1&order=nom&directory=1.20_TRUNK/arm_dm900-solo4k

    et en l'assignant à la variable nomFichier :

    michel@debg53sw:~$ nomFichier=`wget -q -O- --trust-server-names "http://dreamosat.net/oscam/index.php?&direction=1&order=nom&directory=1.20_TRUNK/arm_dm900-solo4k" | grep -Pom1 '.*?href="index.php\?action=downloadfile\&filename=\K.*?(?=&amp)'`
    michel@debg53sw:~$ echo $nomFichier 
    oscam-svn11466-arm_dm900-solo4k-webif-oscam-emu-patched.tar.gz
    

    Pour ensuite insérer la variable nomFichier dans le texte du lien de téléchargement
    en assignant ce texte à la variable HTTPSERV75 :

    michel@debg53sw:~$ HTTPSERV75="http://oscam.dreamosat.net/index.php?action=downloadfile&filename=$nomFichier&directory=1.20_TRUNK/arm_dm900-solo4k&"
    michel@debg53sw:~$ echo $HTTPSERV75
    http://oscam.dreamosat.net/index.php?action=downloadfile&filename=oscam-svn11466-arm_dm900-solo4k-webif-oscam-emu-patched.tar.gz&directory=1.20_TRUNK/arm_dm900-solo4k&
    

    ... et dans ce royaume, ceux qui y voient un peu plus clair sont parfois très mal vus.