[IPython-user] capture shell output with '!!'

Rakotomandimby Mihamina mihamina.rakotomandimby at etu.univ-orleans.fr
Wed Aug 31 06:31:43 CDT 2005


Hi,
I saw in the documentation, a while ago, some tips to capture the output
of a shell command to a variable (a list)

I lost it (the location), and now i'm obliged to use %sc.

My needs:
- I got some mp3/ogg songs from a friend
- The directories and file names contain spaces
- I need to rename thoses files and directories to spaceless names,
replacing spaces with underscore.
- I use the 'find' of the system and it returns a list of paths.
(BTW: is there any internal 'find' into python or ipython?)
- I want to process each element of the list, but I need to store the
list in a variable before, and that is I lost the documentation on.

with %sc:
=============================================
In [3]: %sc -l variable=ls

In [4]: variable
Out[4]:
['correspondance',
 'CPSDocumentations',
 'Desktop',
 'download',
 'funk.m3u',
 'index.html',
 'index_vsftpd.html',
 'index_vsftpd.html~',
 'lip.txt',
 'Music',
 'Pictures',
 'Placard',
 'Programmation',
 'ripped-music',
 'signature.txt',
 'tmp',
 'tmp.txt',
 'video']
================================================

With '!!', I get error syntaxes whatever I try, and I dont find the
documentation.... :-(

SOme tips?
-- 
Administration & Formation à l'administration
de serveurs dédiés:
http://www.google.fr/search?q=aspo+infogerance+serveur




More information about the IPython-user mailing list