0

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

      text=$(ls-al)

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

 fi

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)

#!/bin/bash
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)
   fi

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

1
  • 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. May 25, 2016 at 11:19

2 Answers 2

2

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

Hope it helps

1
  • sorry, I knew it was something stupid, I just found out my mistake and I was going to put a post. May 25, 2016 at 2:15
0

Try:

text="$(ls -la)" 

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

I hope it works for you!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .