[Linux-bruxelles] un fichier peut-il devenir une variable dans un script bash ?

Aldo info at brlspeak.net
Sam 5 Mar 15:45:53 CET 2022


Bonjour Robert. 

J'ai fait qq chose inspiré de ton script
mais il ne me lis vocalement que le nom du fichier txt,
pas son contenu :-( snif! 

Voici:

### début ###

#!/bin/bash 
# Display arguments (such as video filename) 
clear 
echo "De Fr En Es (German/French/English/Spanish) to WAVe  by  Pico2Wave !
 "
echo "Input : $1"
echo "Filename : ${1%%.*}"
echo "Extension : ${1#*.}"
echo "Language : $2"
echo "Supported languages : en-US en-GB FR-FR de-DE es-ES " 
# Call ffmpeg for conversion (to WAV) 
FILEWAVE="${1%%.*}.wav"
echo "Output : $FILEWAVE"
echo " " 
#ffmpeg -i "$1" "$FILEWAVE"
test -z "$1" && echo "** Filename and language are required arguments ** " && exit
pico2wave -w /tmp/$FILEWAVE -l $2 $1 |mplayer -vo null -vc dummy -nolirc -nojoystick -framedrop /tmp/$FILEWAVE
echo "
Read by Pico2Wave . . .
 " 
exit 

### fin ### 

Aldo. 


--- Your session --- 
On Sat, Mar 05, 2022 at 11:28:38AM +0000, Robert VISEUR via Linux-bruxelles wrote:
> Exemple :
> 
> #!/bin/bash
> 
> # display arguments (such as video filename)
> echo "Input : $1"
> echo "Filename : ${1%%.*}"
> echo "Extension : ${1#*.}"
> echo "Language : $2"
> 
> # call ffmpeg for conversion (WAV)
> FILEWAVE="${1%%.*}.wav"
> echo "$FILEWAVE"
> ffmpeg -i "$1" "$FILEWAVE"


Plus d'informations sur la liste de diffusion Linux-bruxelles