Linux Foundation Certified System Administrator (LFCS) — Question 112
After issuing:
function myfunction { echo $1 $2 ; }
in Bash, which output does:
myfunction A B C
Produce?
Answer options
- A. A B
- B. A B C
- C. A C
- D. B C
- E. C B A
Correct answer: A
Explanation
The correct output is A B because the function myfunction is defined to echo only the first two arguments passed to it, which are A and B. The third argument, C, is ignored because the function does not reference it.