Bash command in ruby script - Error "Command not found" -


i need run bash command (ls -al) in ruby script. command launched in different folders start letters "my".

dir.glob("#{path_to_search}/my*",file::fnm_casefold) |path|      command = path + "/ls -al"     output_result = (%x(#{command}))  end 

i receive strange error:

"command not found: /home/user/my123/ls -al" "command not found: /home/user/my222/ls -al" "command not found: /home/user/my423/ls -al" 

the iteration goes well. problem command

you generate commands inproperly. should be:

command = 'ls -al ' + path 

Comments

Popular posts from this blog

javascript - How to name a jQuery function to make a browser's back button work? -

python - Django-easy-pdf: xhtml2pdf reporting reportlab 2.2+ is required, but 3.0 installed -

collision detection - C++ library for mesh to mesh intersection: what is available? -