From f9ed5e9601489a9832b88670575e189fa20cca27 Mon Sep 17 00:00:00 2001 From: Ali Khan Date: Wed, 7 Feb 2018 11:37:27 -0500 Subject: [PATCH] bugfix in finding matching app name --- bidsBatch | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/bidsBatch b/bidsBatch index a47678e..38629f0 100755 --- a/bidsBatch +++ b/bidsBatch @@ -38,12 +38,21 @@ function getContainer { app_name=$1 bids_app_dir=$SINGULARITY_DIR/bids-apps -#get matching line for app_name -linenum=`awk -F '\t' '{print $1}' $app_list | grep -n $app_name` -linenum=${linenum%%:*} +linenum=1 +foundmatch=0 +for app in `awk -F '\t' '{print $1}' $app_list` +do + + if [ "$app" = "$app_name" ] + then + foundmatch=1 + break + fi + linenum=$((linenum+1)) +done -if [ ! -n "$linenum" ] +if [ "$foundmatch" = 0 ] then echo "${app_name} does not exist in bids-app list!" >&2 exit 1