bsdtar

How to escape chars in BSD tar path substitution option

与世无争的帅哥 提交于 2019-12-11 16:16:08
问题 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