When I use:
out = run("ls")
I want in "out" list of files. But, I also get trash. How to get only out of the shell command?
$ fab -p 111 -H server func
[server] Executing task 'func'
[server] run: ls
[server] out:
[server] out:
[server] out: MQSI 9.0.0.3
[server] out: /opt/IBM/mqsi/9.0.0.3
[server] out:
[server] out: /var/mqsi/odbc/odbc64.ini
[server] out: file1 file2 file3
[server] out:
MQSI 9.0.0.3
/opt/IBM/mqsi/9.0.0.3
/var/mqsi/odbc/odbc64.ini
file1 file2 file3
So in out
i get all text from MQSI
to file3
. But I need only file1 file2 file3
Probably it is not fabric fault. Maybe something with server shell.
I very tried use different fabric hiding, but didn't find the answer.
If I understand correctly, by "trash" you're referring to the "\t", "\r", and "\n" characters that are present in the output of the
ls
command. An example I just generated looks like this:To turn that into a list, you can
.split()
it, like: