0

I'm using a terminal program called espeak to convert a string of words into International Phonetic Alphabet (IPA). The main command is:

espeak -v fr --ipa "<string of words>"

Note that the text itself should be in quotations, since espeak -v fr --ipa "Je suis" will give the correct IPA transcription, but espeak -v fr --ipa Je suis will only give the transcription for "Je".

To avoid retyping the same commands every time, I defined the following function in my .bashrc:

function fr {
    espeak -v fr --ipa "$@"
}

However, when I run fr Je suis (without quotations) in my terminal, I only get the result for "Je", even though I have nested the input argument $@ in quotations. Furthermore, when I added echo "$@" within the function, it still prints as "Je suis".

How can I get the function to output the result for the whole string (with white space and new line characters), and not just the first word? Thank you.

seismatica
  • 437
  • 1
  • 6
  • 19
  • 1
    You need to use `$*` - `espeak -v fr --ipa "$*"` – Inian Dec 03 '19 at 07:51
  • 1
    Possible duplicate of [In bash, how do I join N parameters together as a space separated string](https://stackoverflow.com/q/12283463/5291015) – Inian Dec 03 '19 at 07:52

0 Answers0