2
Good guys next, I have this code below for python 2.7:
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import sys
import os
if len(sys.argv) <= 3:
for comando in sys.argv[1:]:
shell = os.system(comando)
print comando
but when I go there terminal type ls -la it return me the following:
┌─[backz]@[NoSafe]:~/hk/programacao/python/manipular_arquivos
└──> $ ./comando.py ls -la
arq.txt comando.py executar_comando.py grep.py os sys usando_argv.py
ls
sh: 0: -c requires an argument
-la
This is only if I type a complete command into the terminal as ls-la. If I type ls, pwd, id and etc unique commands right, it returns me the result in a good. Problem goes to compound command. Searching the internet I realized that it is something direct from the linux shell, it is not an error but a return in which he can not identify.
I would like the help of vcs or is has some other way to effect the process with compound commands thanks.
Thank you @mgibsonbr solved my problem.
– GlaucioFonseca