PrepAway - Latest Free Exam Questions & Answers

What will we see?

We have bash script ~/myscript shown below:
shift echo $2

We call this script:
~/myscript alpha beta gamma delta

What will we see?

PrepAway - Latest Free Exam Questions & Answers

A.
alpha

B.
beta

C.
gamma

D.
delta

Explanation:
shift shifts all arguments to the left (meaning arg1 becomes arg2, arg2 becomes arg3, …), so after the shift the 2nd argument becomes gamma.


Leave a Reply