🔥 3-day streak
CompTIA Linux+ (XK0-006)16 / 123
Question 16 of 123

A colleague wrote a Bash script with a function that computes a value and stores it in a variable named 'result'. After the function runs, the main script uses '$result' but keeps getting the wrong value because an unrelated global variable also named 'result' is being overwritten by the function. What is the BEST way to fix the function so it does not clobber the global variable while still returning its computed value to the caller?

Reviewed for accuracy · Report an issueNext question