Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Linux Script Tracing Problem A script file tracethis.sh has the code below. What will the output be for the following calls to the script file?
Linux Script Tracing Problem
A script file tracethis.sh has the code below. What will the output be for the following calls to the script file? The commands are given in bold text: #!/bin/bash if [ $# -ne 1 ]; then echo "Error!" 1>&2 exit 1 if [ $1 -le 0 ]; then echo "Error!" 1>&2 exit 2 elif [ $1 -le 2 ]; then echo "1" else VAR1=1 VAR2=1 RESULT=$($VAR1+$VAR2)) i=3 while [ $i -lt $1 ); do VAR1=$VAR2 VAR2=$RESULT RESULT=$(($VAR1+$VAR2)) i=$(($i+1)) done echo $RESULT fi (a) What is the output of the following: $ tracethis.sh -1? (b) What is the output of $ echo $? after a)? (c) What is the output of the following: $ tracethis.sh 3? (d) What is the output of $ echo $? after c)? (e) What is the output of the following: $ tracethis.sh 1Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started