I'm talk about the "ar" command in Linux/UNIX which is used for creating or managing archives.
According to the manual, we can move members in an archive with "m" modifier. But there isn't any example.
The manual page just say "If no modifiers are used with m, any members you name in the member arguments are moved to the end of the archive;", so I guess it should work like this (and I was successful):
$ ar -t out.a
a.txt
b.txt
c.txt
d.txt
$ ar m out.a a.txt
$ ar -t out.a
b.txt
c.txt
d.txt
a.txt
$
File "a.txt" was successfully moved to the end.
But when it comes to "you can use the a, b, or i modifiers to move them to a specified place instead", I got problem:
$ ar t out.a
a.txt
b.txt
c.txt
d.txt
$ ar ma out.a a.txt
ar: a.txt: File format not recognized
$
I thought "a" means move ahead, while "b" move backward, "i" move to index, there might be a number after the modifier. So I tried:
$ ar t out.a
a.txt
b.txt
c.txt
d.txt
$ ar ma 1 out.a a.txt
$ ar t out.a
b.txt
c.txt
d.txt
a.txt
$
"a.txt" is still moved to the end!
And when I want to move a file backward, it was still moved to then end:
$ ar t out.a
a.txt
b.txt
c.txt
d.txt
$ ar mb 1 out.a c.txt
$ ar t out.a
a.txt
b.txt
d.txt
c.txt
$
So how to use it?
Asked by Vespene Gas
(163 rep)
Dec 26, 2019, 07:56 AM
Last activity: Dec 26, 2019, 01:06 PM
Last activity: Dec 26, 2019, 01:06 PM