diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6264f76e6f08e3fc0e935bbba8126df48f1e61ae..9cceb496efc510969dd97b684b0e145e47196e83 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -107,7 +107,7 @@ countData:
   script:
   - singularity run 'docker://bicf/subread2:2.0.0' featureCounts -T 20 -a /project/BICF/BICF_Core/shared/gudmap/references/GRCh38.p12.v31/genome.gtf -G /project/BICF/BICF_Core/shared/gudmap/references/GRCh38.p12.v31/genome.fna -g 'gene_name' -o Q-Y5F6_1M.se.featureCounts -s 1 -R SAM --primary --ignoreDup ./test_data/bam/small/Q-Y5F6_1M.se.sorted.deduped.bam 
   - singularity run 'docker://bicf/subread2:2.0.0' Rscript ./workflow/scripts/calculateTPM.R --count ./test_data/counts/small/Q-Y5F6_1M.se.featureCounts
-  - assignedReads=grep -m 1 'Assigned' *.countData.summary | grep -oe '\([0-9.]*\)'
+  - assignedReads=$(grep -m 1 'Assigned' *.countData.summary | grep -oe '\([0-9.]*\)')
   - pytest -m makeFeatureCounts
 
 makeBigWig:
diff --git a/workflow/rna-seq.nf b/workflow/rna-seq.nf
index bcdcb8b63f0a2872ec98bdc43a4583153f804f18..dc0a8d194891c8e655c77940ff94b668723d8188 100644
--- a/workflow/rna-seq.nf
+++ b/workflow/rna-seq.nf
@@ -877,7 +877,7 @@ process countData {
     echo -e "LOG: counted" >> ${repRID}.countData.log
     
     # extract assigned reads
-    assignedReads=grep -m 1 'Assigned' *.countData.summary | grep -oe '\\([0-9.]*\\)'
+    assignedReads=\$(grep -m 1 'Assigned' *.countData.summary | grep -oe '\\([0-9.]*\\)')
     echo -e \${assignedReads} > assignedReads.csv
     echo -e "LOG: assigned reads: "\${assignedReads} >> ${repRID}.countData.log