Sha256: 528b0d38c531b38e23739a4c9bff7744d13a443ff7cf1db0a97a9a7afea35c7c

Contents?: true

Size: 495 Bytes

Versions: 58

Compression:

Stored size: 495 Bytes

Contents

#!/bin/bash

input="$1";

a=0
c=0
g=0
t=0

function end() {
        echo "A: ${a}"
        echo "C: ${c}"
        echo "G: ${g}"
        echo "T: ${t}"
	exit
}

if [ ! -n "$input" ]; then
	end
fi

for i in $(seq 1 ${#input}); do
	char=${input:i-1:1}
	if [ "${char}" = "A" ]; then
		a=$((a+1))
	elif [ "${char}" = "C" ]; then
		c=$((c+1))
	elif [ "${char}" = "G" ]; then
		g=$((g+1))
	elif [ "${char}" = "T" ]; then
		t=$((t+1))
	else
		echo "Invalid nucleotide in strand"
		exit 1
	fi
done

end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
trackler-2.2.1.82 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.81 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.80 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.79 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.78 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.77 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.76 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.75 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.74 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.73 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.72 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.71 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.70 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.69 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.68 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.67 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.66 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.65 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.64 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.63 tracks/bash/exercises/nucleotide-count/example.sh