3.3 Command Line - Turning Commands into a Script Flashcards
Shell scripts start with the following sequence to define the interpreter:
A) /bin/bash
B) #!
C) $#
D) !#
!
Which of these is a valid for loop?
A) while [ $i -le $count ]; echo $i && count=$[$count+1]; done
B) for i in {1..10}; do echo $i; done
C) for i in one two three; echo $1
D) loop 1-10; echo $i
for i in {1..10}; do echo $i; done
Which of the following sets the variable myvar equal to Apple?
A) myvar==”Apple”
B) $myvar=”Apple”
C) $myvar==”Apple”
D) myvar=”Apple”
myvar=”Apple”
Which of these is a valid if statement?
A) if $i=”1”; echo $i
B) if [ $i -eq true ] echo $i; done
C) if $i = “”; echo $i; d=fi
D) if [ -n $i ]; then echo $i; fi
if [ -n $i ]; then echo $i; fi