How to escape chars in BSD tar path substitution option
问题 This does not work: $ tar -cf /tmp/z.tar -C /space/myroot -s '/^\.svn\/patches/__patches' src .svn/patches tar: Invalid regular expression: trailing backslash (\) Also no good: $ tar -cf /tmp/z.tar -C /space/myroot -s '/^\\.svn\\/patches/__patches' src .svn/patches tar: Invalid replacement flag _ Every combination of backslashes (up to 4) and quoting gives me one of those two errors. However I know the first one works in sed: $ tar -cf /tmp/z.tar -C /space/myroot src .svn/patches $ tar -tf