ar – create, modify, and extract from archives

ABOUT ar
The archiver, also known simply as ar, is a Unix utility that maintains groups of files as a
single archive file. Today, ar is generally used only to create and update static library files
that the link editor or linker uses and for generating .deb packages for the Debian family; it
can be used to create archives for any purpose, but has been largely replaced by tar for
purposes other than static libraries.[3] An implementation of ar is included as one of the GNU
Binutils.[2]

[bash]
$ar artest.a artest.txt
ar: two different operation options specified
$ar r artest.a artest.txt
ar: creating artest.a
$file artest.a
artest.a: current ar archive
$cat artest.a
!<arch>
artest.txt/ 0 0 0 644 36 `
https://youtu.be/-jXqwdd3hk4?t=2418&#8217;
$cat artest.txt
https://youtu.be/-jXqwdd3hk4?t=2418&#8217;

[/bash]

[text]
Single quotes in the shell session are used to hide certain things in wordpress post
They are not part of the real content.
[/text]

LINKS
https://www.geeksforgeeks.org/ar-command-in-linux-with-examples/
https://en.wikipedia.org/wiki/Ar_(Unix)

Simple example of a bash builtin command named “wait”

ABOUT wait

wait waits for the process identified by process ID pid (or the job specified by job ID jobid), and
reports its termination status. If an ID is not given, wait waits for all currently active child
processes, and the return status is zero. If the ID is a job specification, wait waits for all processes
in the job's pipeline.

A TYPICAL SHELL EXPOSURE
[bash]
$sleep 10 &
[1] 7122
$wait 7122
[1]+ Done sleep 10
$sleep 20 &
[1] 7125
$wait 7125
[1]+ Done sleep 20
$sleep 20 &
[1] 7128
$wait 7128
[1]+ Done sleep 20
$sleep 20 &
[1] 7135
$wait 7135
[1]+ Done sleep 20
$wait
$wait
$

[/bash]

LINK
https://www.computerhope.com/unix/uwait.htm

Fundamentals related to a bash builtin command named “test”

ABOUT test

test provides no output, but returns 0 for "true" (test successful) and 1 for "false" (test failed).

RELATED COMMAND LINE EXPOSURE
[bash]
$num=10; if (test $num -gt 5); then echo "yes"; else echo "no"; fi
yes
$num=1; if (test $num -gt 5); then echo "yes"; else echo "no"; fi
no
$num=5; if (test $num -gt 5); then echo "yes"; else echo "no"; fi
no
$

[/bash]
LINK
https://www.computerhope.com/unix/bash/test.htm

Fundamentals related to bash builtin command named “shift”

ABOUT shift

shift [n]

The  positional  parameters  from  n+1  ...  are renamed to $1 ....  Parameters represented by the
numbers $# down to $#-n+1 are unset.  n must be a non-negative number less than or equal to $#.  If n is
0, no parameters  are  changed. If  n  is not given, it is assumed to be 1.  If n is greater than $#, the
positional parameters are not changed.  The return status is greater than zero if n is greater than $# or
less than zero; otherwise 0.

[bash]
$cat posiwork
shift
echo $1
$./posiwork hello world
world
$./posiwork hello

$./posiwork hello world people
world
$emacs posiwork
$cat posiwork
shift 2
echo $1
$./posiwork hello world people
people
$

[/bash]
LINKS
https://askubuntu.com/questions/939620/what-does-mean-in-bash
https://www.computerhope.com/unix/bash/shift.htm

About bash builtin command named “eval”

ABOUT eval

eval is a builtin command of the Bash shell. It concatenates its arguments into a single string, joining the arguments with spaces, then executes that string as a bash command. It's similar to running bash -c "string", but eval executes the command in the current shell environment rather than creating a child shell process.

TYPICAL SHELL SESSION RELATED
[bash]
$eval ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 70:5a:0f:b9:d8:5c brd ff:ff:ff:ff:ff:ff
3: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 68:14:01:07:36:1f brd ff:ff:ff:ff:ff:ff
inet 192.168.1.5/24 brd 192.168.1.255 scope global dynamic noprefixroute wlp2s0
valid_lft 253560sec preferred_lft 253560sec
inet6 fe80::6324:f2f6:2c32:5ac8/64 scope link noprefixroute
valid_lft forever preferred_lft forever
$echo $?
0
$echo $eval

$eval pw d
bash: pw: command not found
$eval

[/bash]
LINK
https://www.computerhope.com/unix/bash/eval.htm

a look into the bash builtin command named “disown”

[bash light=”true”]
$jobs -l
$ping gnu.org
PING gnu.org (208.118.235.148) 56(84) bytes of data.
64 bytes from wildebeest.gnu.org (208.118.235.148): icmp_seq=1 ttl=53 time=267 ms
64 bytes from wildebeest.gnu.org (208.118.235.148): icmp_seq=2 ttl=53 time=266 ms
64 bytes from wildebeest.gnu.org (208.118.235.148): icmp_seq=3 ttl=53 time=267 ms
64 bytes from wildebeest.gnu.org (208.118.235.148): icmp_seq=4 ttl=53 time=321 ms
64 bytes from wildebeest.gnu.org (208.118.235.148): icmp_seq=5 ttl=53 time=268 ms
^Z
[1]+ Stopped ping gnu.org
$jobs -l
[1]+ 3882 Stopped ping gnu.org
$disown
bash: warning: deleting stopped job 1 with process group 3882
$jobs -l
$ping gnu.org
PING gnu.org (208.118.235.148) 56(84) bytes of data.
64 bytes from wildebeest.gnu.org (208.118.235.148): icmp_seq=1 ttl=53 time=267 ms
64 bytes from wildebeest.gnu.org (208.118.235.148): icmp_seq=2 ttl=53 time=267 ms
^C
— gnu.org ping statistics —
3 packets transmitted, 2 received, 33.3333% packet loss, time 3ms
rtt min/avg/max/mdev = 266.815/266.868/266.921/0.053 ms
$xeyes &
[1] 3885
$jobs -l
[1]+ 3885 Running xeyes &
$jobs -l
[1]+ 3885 Running xeyes &
$disown
$jobs -l
$jobs -l
$fg 1
bash: fg: 1: no such job
$

[/bash]
link: https://www.cyberciti.biz/faq/unix-linux-disown-command-examples-usage-syntax/

Hacking with Makefile for machine architecture detection

# SPDX-License-Identifier: GPL-2.0
INCLUDEDIR := -I.
CFLAGS := $(CFLAGS) $(INCLUDEDIR) -Wall -O2 -g

TEST_GEN_FILES := adi-test
UNAME := $(shell uname -m)

all: $(TEST_GEN_FILES)	

$(TEST_GEN_FILES): adi-test.c 
ifeq ($(UNAME), sparc64)
	$(info Machine architecture does match)
else
	$(info exit)
	$(error Machine architecture does not match)
endif  

TEST_PROGS := drivers_test.sh

include ../../lib.mk

$(OUTPUT)/adi-test: adi-test.c