[Assorted-commits] SF.net SVN: assorted: [255] shell-tools/trunk/src/quote.py
                
                Brought to you by:
                
                    yangzhang
                    
                
            
            
        
        
        
    | 
      
      
      From: <yan...@us...> - 2008-01-20 06:36:13
      
     | 
| Revision: 255
          http://assorted.svn.sourceforge.net/assorted/?rev=255&view=rev
Author:   yangzhang
Date:     2008-01-19 22:36:17 -0800 (Sat, 19 Jan 2008)
Log Message:
-----------
quote for bash strings
Added Paths:
-----------
    shell-tools/trunk/src/quote.py
Added: shell-tools/trunk/src/quote.py
===================================================================
--- shell-tools/trunk/src/quote.py	                        (rev 0)
+++ shell-tools/trunk/src/quote.py	2008-01-20 06:36:17 UTC (rev 255)
@@ -0,0 +1,8 @@
+#!/usr/bin/env python
+# vim:et:sw=2:ts=2
+import sys
+
+def quote(s):
+  return r'"%s"' % s.replace('\\', r'\\').replace('"', r'\"').replace('$', r'\$')
+
+print ' '.join( map( quote, sys.argv[1:] ) )
Property changes on: shell-tools/trunk/src/quote.py
___________________________________________________________________
Name: svn:executable
   + *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |