#!/bin/bash clear echo \"Enter your oligonucleotide sequence: \" read SEQ if [[
ID: 3583624 • Letter: #
Question
#!/bin/bash
clear
echo "Enter your oligonucleotide sequence: "
read SEQ
if [[ "$SEQ" == [ATCGatcg] ]];
then
echo "Your entered oligonucleotide sequence is $SEQ"
else
echo "Error! $SEQ is not a valid sequence. Enter an oligonucleotide sequence."
fi
I need to write a script that checks if an entered string is an oligonucleotide. An oligonucleotide is a string of any length that contains only A,G,C,T,a,c,g,t. If they contain any other characters, it is not an oligonucleotide. I have the script below but can only get one output and not the other. Please help.
Explanation / Answer
Answer :
From above your program it will only give you positive output if you input excat matching string like "ACTGactg".
But program logic different to find if any of these character is there or not.
You can change your if line like this :
if [ ("$c" -ne "A") -o ("$c" -ne "T") -o ("$c" -ne "C") -o ("$c" -ne "G") -o ("$c" -ne "a") -o ("$c" -ne "t") -o ("$c" -ne "c") -o ("$c" -ne "g") ];
it will check the possibility of the character letters into your string.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.