Given the following shell script binsh VECTORvectorsfastavec
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
Solution
#!/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
