Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given the following shell script #!/bin/sh VECTOR=vectors.fasta:vector_terminal

ID: 3786771 • Letter: G

Question

Given the following shell script

#!/bin/sh
VECTOR=vectors.fasta:vector_terminal
for file in $*
do
echo $file
needle -gapopen 10 -gapextend 0.5 -outfile $file.needle
-datafile DNAMAT $VECTOR $file.fasta
done

we invoke the script above by the following command

sh -x ./loop 441E877 441E1189 441E2320 441EBF1

Modify the given shell script o that the variable VECTOR is set to have, as its value, the first argument given on the command line when the script is invoked. Recall that this value will be in the shell variable 1 which can be obtained within the shell using the syntax (notation) $1.

After VECTOR is set, use the shift command to remove this command-line argument. The rest of the script should be as before.

You should be able to invoke your script as follows:

./loop vectors.fasta:vector_terminal 441E877 441E1189 441E2320 441EBF1

Explanation / Answer

#!/bin/sh
VECTOR=$1
shift
for file in $*
do
echo $file
needle -gapopen 10 -gapextend 0.5 -outfile $file.needle
-datafile DNAMAT $VECTOR $file.fasta
done

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote