0

I'm trying to call a command from a variable in a script with a specific locale, example :

$ myYTDL="LANG=C.UTF-8 youtube-dl --get-filename"

but each time I try and call it in the script, I get :

$ $myYTDL $url
LANG=C.UTF-8: command not found

How can I do that ?

SebMa
  • 2,149
  • @kusalananda I thought my question was one specific to the assignment before the command in the variable. I didn't know this could be solved by calling the eval builtin :

    myYTDL="eval LANG=C.UTF-8 youtube-dl"

    Thanks bro :)

    – SebMa Mar 12 '19 at 10:36
  • 1
    That's definitely the wrong take-home message from that question. Use a shell function or put the command into an array. – Kusalananda Mar 12 '19 at 11:07

0 Answers0