Ben Love on 21 Aug 2009 12:30:30 -0700 |
* TuskenTower (tuskentower@gmail.com) wrote: > Someone decided the dollar sign was the least likely to find in a > filename and produced the above code. Another voiced concern over > legibility and to stick to characters that don't require escaping. The only characters guaranteed to never appear in a filename (on most filesystems anyway) are the forward slash and the NUL (0). Of course, your path will have lots of legitimate forward slashes, so I'd argue that NUL is really your only choice. But your shell and/or sed might choke on that. The safest way might be to do it in multiple steps, and use some form of C-style escaping. 1) Convert backslash to double-backslash. 2) Convert any delimeter characters to backslash+D. 3) Do your sed string with chosen delimiter. 4) Convert backslash+D back to delimeter. 5) Convert double-backslash back to backslash. Of course, if you use sed to do the converts you're back at the same problem! -- Ben Love blove+signature (at) kylimar.com || ASCII ribbon campaign - () http://www.kylimar.com/ || against HTML e-mail - /\ Attachment:
signature.asc ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
|
|