Any example of the difference between adding modifer "c" and "s" or not to "ar" command
-1
votes
2
answers
140
views
Many articales provide examples of using "ar" command uses "ar rcs " without explaination of the reason.
I've tried the command by myself both with and without modifier "c" and "s" and find that the output are idendical even in binary comparasion.
Run "ar" without modifier "c" and "s":
$ ar r out.a *.txt
ar: creating out.a
$ hexdump -C out.a
00000000 21 3c 61 72 63 68 3e 0a 61 2e 74 78 74 2f 20 20 |!.a.txt/ |
00000010 20 20 20 20 20 20 20 20 31 35 37 37 33 35 33 37 | 15773537|
00000020 35 38 20 20 31 30 30 30 20 20 31 30 30 30 20 20 |58 1000 1000 |
00000030 31 30 30 36 36 34 20 20 34 20 20 20 20 20 20 20 |100664 4 |
00000040 20 20 60 0a 61 62 63 0a 62 2e 74 78 74 2f 20 20 | `.abc.b.txt/ |
00000050 20 20 20 20 20 20 20 20 31 35 37 37 33 35 33 37 | 15773537|
00000060 35 38 20 20 31 30 30 30 20 20 31 30 30 30 20 20 |58 1000 1000 |
00000070 31 30 30 36 36 34 20 20 34 20 20 20 20 20 20 20 |100664 4 |
00000080 20 20 60 0a 64 65 66 0a | `.def.|
00000088
$ rm out.a
Run "ar" with modifier "c" and "s":
$ ar rcs out.a *.txt
$ hexdump -C out.a
00000000 21 3c 61 72 63 68 3e 0a 61 2e 74 78 74 2f 20 20 |!.a.txt/ |
00000010 20 20 20 20 20 20 20 20 31 35 37 37 33 35 33 37 | 15773537|
00000020 35 38 20 20 31 30 30 30 20 20 31 30 30 30 20 20 |58 1000 1000 |
00000030 31 30 30 36 36 34 20 20 34 20 20 20 20 20 20 20 |100664 4 |
00000040 20 20 60 0a 61 62 63 0a 62 2e 74 78 74 2f 20 20 | `.abc.b.txt/ |
00000050 20 20 20 20 20 20 20 20 31 35 37 37 33 35 33 37 | 15773537|
00000060 35 38 20 20 31 30 30 30 20 20 31 30 30 30 20 20 |58 1000 1000 |
00000070 31 30 30 36 36 34 20 20 34 20 20 20 20 20 20 20 |100664 4 |
00000080 20 20 60 0a 64 65 66 0a | `.def.|
00000088
$
So anybody can give an example to show the difference between adding and not adding the modifier?
I've read the manual page but still can't get the point.
----------
**Added 2019-12-27 02:28:45 UTC**
Thank you. Now I've understand modifier "c", but still have questions on modifier "s".
Many have mentioned "symbol", but what does it mean?
I've tried symbol link, but they are still identical:
[john@centos8-01 arTest]$ ls -l
total 8
-rw-r--r--. 1 john smith 4 Dec 27 10:18 a.txt
-rw-r--r--. 1 john smith 4 Dec 27 10:19 b.txt
lrwxrwxrwx. 1 john smith 5 Dec 27 10:19 c.txt -> a.txt
[john@centos8-01 arTest]$ ar -r out1.a *.txt
ar: creating out1.a
[john@centos8-01 arTest]$ ar -rs out2.a *.txt
ar: creating out2.a
[john@centos8-01 arTest]$ diff out1.a out2.a
[john@centos8-01 arTest]$ cat out1.a
!
a.txt/ 1577413136 1001 1001 100644 4 `
abc
b.txt/ 1577413141 1001 1001 100644 4 `
def
c.txt/ 1577413136 1001 1001 100644 4 `
abc
[john@centos8-01 arTest]$ cat out2.a
!
a.txt/ 1577413136 1001 1001 100644 4 `
abc
b.txt/ 1577413141 1001 1001 100644 4 `
def
c.txt/ 1577413136 1001 1001 100644 4 `
abc
[john@centos8-01 arTest]$
And I've tried adding symbols to my txt files:
[john@centos8-01 arTest]$ cat a.txt
abc
!@#$%^&*()_+-=~`[]\{}|;':"?,./
[john@centos8-01 arTest]$
As you can see "a.txt" had no symbols before but letters "abc" only, but now I've added all the symbols I can find on my keyboard. Now I run "ar" with and without modifier "s", but they are still identical:
[john@centos8-01 arTest]$ ls
a.txt b.txt
[john@centos8-01 arTest]$ ar r out1.a *.txt
ar: creating out1.a
[john@centos8-01 arTest]$ ar rs out2.a *.txt
ar: creating out2.a
[john@centos8-01 arTest]$ diff out1.a out2.a
And there is no "symbol table":
[john@centos8-01 arTest]$ cat out1.a
!
a.txt/ 1577413538 1001 1001 100644 37 `
abc
!@#$%^&*()_+-=~`[]\{}|;':"?,./
b.txt/ 1577413141 1001 1001 100644 4 `
def
[john@centos8-01 arTest]$ cat out2.a
!
a.txt/ 1577413538 1001 1001 100644 37 `
abc
!@#$%^&*()_+-=~`[]\{}|;':"?,./
b.txt/ 1577413141 1001 1001 100644 4 `
def
[john@centos8-01 arTest]$
Asked by Vespene Gas
(163 rep)
Dec 26, 2019, 10:05 AM
Last activity: Dec 27, 2019, 03:37 AM
Last activity: Dec 27, 2019, 03:37 AM