Is there any ar option to extract objects to a different directory ? Any way to extract them to tmp below ?
[test]# ls -l
total 1828
-rw-r--r-- 1 root root 1859628 Aug 24 02:10 libclsr11.a
drwxr-xr-x 2 root root 4096 Aug 24 02:12 tmp
[test]# ar x libclsr11.a
[test]# ls -l
total 3760
-rw-r--r-- 1 root root 157304 Aug 24 02:13 clsrcact.o
-rw-r--r-- 1 root root 19304 Aug 24 02:13 clsrcclu.o
-rw-r--r-- 1 root root 55696 Aug 24 02:13 clsrccss.o
..
drwxr-xr-x 2 root root 4096 Aug 24 02:12 tmp
[test]#
--output
option was introduced in version 2.34 of ar / binutils which was released in February 2020, more than three years after the initial answer. I've updated my answer to include the new option for more recent versions. – Photomicroscope