There is nothing in GNU cpio to allow for this. This might be a little cleaner:
(cd /some/dir && cpio -whatever < /some/file)
Using the subshell parentheses will preserve the scripts current working directory and using && will ensure that the cpio extraction is only done if you successfully change directories to the target.
There is nothing in GNU cpio to allow for this. This might be a little cleaner:
Using the subshell parentheses will preserve the scripts current working directory and using && will ensure that the cpio extraction is only done if you successfully change directories to the target.
Adding a little more to what TCampbell did:
(cp /some/file /some/dir && cd /some/dir && cpio -whatever < file && rm -f file)