I am trying someting very easy, I have seen some answer, but they do not work

I am trying to send the output of ls-al to a variable

some code before this line

if [[ $ans == "L"* ]];then


      zenity --info --title="contenu du repertoire" --text=$text


when I try this, I get the error ./testzenity: ligne 10: ls-al : commande introuvable

this is in french and it means command not found

I have the same result with text=ls-al``

I even tried read text << (ls-al), but htis time i get

./testzenity: ligne 12: erreur de syntaxe près du symbole inattendu « ( »
which means syntax error near symbol "("

What am I doing wrong, this is very basic

Ok, the first par of the script works, now I have a problem with Zenity

here is the code (well, part of it)

ans=$(zenity --list --text "Faites votre choix " --title "Menu utilitaire" --radiolist \

 --column "" --column "Choix" \

   TRUE   "Lister le contenu du repertoire" \

FALSE  "Editer un fichier" \

   FALSE  "Crer un nouvel usager" \

   FALSE  "Quitter" )

   if [[ $ans == "L"* ]];then

      text=$(ls -al)

  zenity --text-info --title="contenu du repertoire" --text=$(text)

I am trying to output the content of the variable text into a textinfo or text box, the text-info box open with the title, but no text inside the box

  • If you have a different or follow-up question, please open a new question. Changing the question doesn't do any good because it changes the requirements for previously existing answers and may invalidate them. – David Foerster May 25 '16 at 11:19

Here ./testzenity: ligne 10: ls-al : commande introuvable it saying. No command like ls-la. it is ls -la.

Hope it helps

  • sorry, I knew it was something stupid, I just found out my mistake and I was going to put a post. – Yves Laurin May 25 '16 at 2:15


text="$(ls -la)" 

Note the quotation marks in the variable that contains the output.

I hope it works for you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.