Write a sequence of commands or a script that demonstrates variable expansion occurs before pathname expansion.

What will be an ideal response?


The following sequence of commands demonstrates variable expansion
occurs before pathname expansion:
$ ls g?
g1 g2 g5 g8
$ a=g?
$ echo "$a"
g?
$ echo $a
g1 g2 g5 g8
Because neither single nor double quotation marks allow pathname expan-
sion, the first echo command displays the unexpanded argument g?. The

shell expands the variable but does not expand the pathname.
If pathname expansion occurred prior to variable expansion, the shell, in
the case of the second echo, would not treat the question mark as a special
character. After expansion, the argument that the shell passed to echo would
be g?, which echo would display.
Following is another example that demonstrates variable expansion occurs
before pathname expansion:
$ cat t1
touch /tmp/$1*
$ touch /tmp/hello
$ ls -l /tmp/hello
-rw-rw-r--. 1 max pubs 0 03-24 19:55 /tmp/hello
$ sleep 60
$ t1 h
$ ls -l /tmp/hello
-rw-rw-r--. 1 max pubs 0 03-24 19:56 /tmp/hello

Computer Science & Information Technology

You might also like to view...

Answer the following statement(s) true (T) or false (F)

Evidence artifacts vary depending on the social media channel and the device.

Computer Science & Information Technology

Which of the following is not one of the devices in RADIUS central authentication?

the supplicant the verifier the authenticator the RADIUS central authentication server

Computer Science & Information Technology

Under normal circumstances, which of the following wireless standards provides the slowest transfer speed at2.4GHz

A. 802.11a B. 802.11b C. 802.11g D. 802.11n

Computer Science & Information Technology

A 3D model always has at least one mesh. _________________________

Answer the following statement true (T) or false (F)

Computer Science & Information Technology