1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| Python 3.2.2 (default, Sep 5 2011, 22:09:30)
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> script = "ls -Al > testclient.txt | tail testclient.txt > second.txt"
>>> import subprocess
>>> retour = subprocess.call(["ssh", "patrice@127.0.0.1", script])
patrice@127.0.0.1's password:
>>> quit()
patrice@Zeus:~/Bureau$ ls second.txt
ls: impossible d'accéder à second.txt: Aucun fichier ou dossier de ce type
patrice@Zeus:~/Bureau$ cd ..
patrice@Zeus:~$ pwd
/home/patrice
patrice@Zeus:~$ ls second.txt
second.txt
patrice@Zeus:~$ cat second.txt
-rw-r--r-- 1 patrice patrice 403 2007-10-29 01:54 webradios.m3u
-rw-r--r-- 1 patrice patrice 37360 2008-05-08 13:14 wget-log
-rw-r--r-- 1 patrice patrice 105485 2008-07-13 18:58 wget-log.1
-rw-r--r-- 1 patrice patrice 14069 2008-07-10 09:17 wiki xubuntu
-rw-r--r-- 1 patrice patrice 1449575 2007-08-18 15:27 Win98SE driver 4.0.100.1190.exe
drwxrwxr-x 4 patrice patrice 4096 2012-04-01 09:29 .wine
-rw------- 1 patrice patrice 11466 2009-07-26 09:40 wsbnote.bck
-rw------- 1 patrice patrice 49 2012-05-26 06:02 .Xauthority
-rw-r--r-- 1 root root 5179 2012-04-28 17:32 xorg.conf.new
-rw------- 1 patrice patrice 30767 2012-05-26 09:52 .xsession-errors |