So, I am trying to pass parameters to a bash shell script across a python TCP socket connection. The script being executed in the bash shell always bombs out even though when I print the variable being passed to os.system() or subprocess.call() it looks correct. Any ideas? Small chunk of the code that is giving me issues.
while 1:
conn, addr = s.accept()
print 'Connected with ' + addr[0] + ':' + str(addr[1])
data = conn.recv(1024)
if not data:
break
data2 = data.rstrip('\n')
cmd = 'ls ' + data2
#os.system(cmd)
subprocess.call([cmd], shell=True)
print cmd