Bonjour,

Pouvez-vous me rappeler comment exécuter un script bash s’il vous plait ?


root@localhost:/bin# cd /home/bertrand 
root@localhost:/home/bertrand# ls -alt cap\* 
\-rw-r--r--. 1 bertrand bertrand 811  1 fév 18:49 capture.sh 
root@localhost:/home/bertrand# chmod +x capture.sh 
root@localhost:/home/bertrand# ls -alt cap\* 
\-rwxr-xr-x. 1 bertrand bertrand 811  1 fév 18:49 **capture.sh** 
root@localhost:/home/bertrand# ./capture.sh 
\-bash: ./capture.sh : ne peut exécuter : le fichier requis n'a pas été trouvé 
root@localhost:/home/bertrand# 
 

pourtant mon fichier existe bien dans /home/bertrand et est exécutable ?

J’ai essayé de le mettre dans /usr/local/bin ne fonctionne pas non plus

merci

    rapy73

    ls -l nomdufichier.sh

    pour voir si il est executable.

    Contient il le shebang pour bash ?

    et ./nomdufichier.sh

    Après un : chmod +x nomdufichier.sh

      • Meilleure réponsesélectionnée par rapy73

      Salut.

      Essaye :

      $ sh ./nomdufichier.sh

      ++

        rapy73 Ton fichier contient quoi ?
        Pourquoi être root pour lancer un script dans ton home ?

          Nicosss

          Voilà le contenu du script

          j’ai pu le lancer avec sh ./capture.sh mais il plante sur les 1eres lignes.

          Le but sous wayland, est d’enregistrer en vidéo ce qui se passe à l’écran avec le son.

          
          \#!/bin/bash
          
          \# Nom du fichier de sortie
          
          OUTPUT="capture.mp4"
          
          FRAMERATE=30
          
          BITRATE_AUDIO=192k
          
          \# Récupérer le flux vidéo Wayland via PipeWire
          
          SCREEN_SOURCE=$(pw-cli list-objects | grep "[node.name](http://node.name/)" | grep "screen-cast" | head -n 1 | awk -F '"' '{print $2}')
          
          \# Vérifier si un écran est détecté
          
          if [ -z "$SCREEN_SOURCE" ]; then
          
          echo "Erreur : Impossible de détecter un flux d'écran sous Wayland."
          
          echo "Assurez-vous d'avoir activé la capture d'écran dans votre gestionnaire de permissions (ex: xdg-desktop-portal)."
          
          exit 1
          
          fi
          
          \# Lancer l'enregistrement avec FFmpeg
          
          ffmpeg \\
          
          \-framerate $FRAMERATE -f pipewire -i "$SCREEN_SOURCE" \\
          
          \-f pulse -ac 2 -i default \\
          
          \-c:v libx264 -preset ultrafast -crf 18 \\
          
          \-c:a aac -b:a $BITRATE_AUDIO \\
          
          \-pix_fmt yuv420p -y "$OUTPUT"
          
          

          Attention ici il met un \ devant certaine lignes (comme le 1ere) que je n’ai pas dans le fichier script

          merci

          eddy33

          oui c’est bien :

          sh ./capture.sh pour le lancer

          merci.