Sha256: 8cae1bb52cccbf07f6dc1b805a999da56996aeea278953e2998be527b4375cb6

Contents?: true

Size: 503 Bytes

Versions: 96

Compression:

Stored size: 503 Bytes

Contents

#!/usr/bin/env 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

96 entries across 96 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.179 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.178 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.177 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.176 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.175 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.174 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.173 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.172 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.171 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.170 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.169 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.167 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.166 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.165 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.164 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.163 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.162 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.161 tracks/bash/exercises/nucleotide-count/example.sh
trackler-2.2.1.160 tracks/bash/exercises/nucleotide-count/example.sh