You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Qsub脚本报错:无法运行任务,脚本长度与声明长度不匹配

qsub添加-v参数触发报错的排查求助

我编写了一个向队列提交处理任务的脚本,提交前会为各数据点分配字符串变量作为qsub的参数。为配置工作环境,我在qsub命令中添加了-v参数,却触发了报错。现有调试资料极少,仅查到可能是qsub命令存在多余空格,但我已通过echo验证命令输入正确,请问有人遇到过该问题吗?

以下是我的脚本:

#!/bin/bash
# This script is for submitting the initial registration subjects for Greedy registration.
# It can serve as a template for later studies when multiple submissions could be handy

# GO_HOME = Origin diqrectory for all niftis of interest
GO_NIFTI="/gpfs/fs001/medorg/comp_space/myname/Test-Retest/Nifti/"
GO_B0="/gpfs/fs001/medorg/comp_space/myname/Test-Retest/Protocols/ants_SyNBaseline/W_Registration_antsSyN_Baseline7/"
GO_FM="/gpfs/fs001/medorg/comp_space/myname/Test-Retest/Protocols/brainmage_batch_t1/"
FINAL_DESTINATION="/gpfs/fs001/cbica/comp_space/wingerti/Test-Retest/Protocols/Registration_greedy_Rigid/"



cd $GO_NIFTI
nii_directories=($(find . -type d -name "*t1*" -o -name "*t0*" -o -name "*t2*" -maxdepth 1 ))

module load greedy

# Will look at these subjects individually, taking them out list to not run DTI_Preprocess
unset nii_directories[27] # 1000009_t0_test
unset nii_directories[17] # 1000001_t0
unset nii_directories[4] # 1000009_t2

# With directories, navigate into each, and find where the suitable niis are (31dir and 33dir)
for g in "${nii_directories[@]}";
do
  # Subject ID argument
  subjid=${g:2:9}
  echo "$subjid is the subject ID..."

  # -i argument (T1 NIFTI File and DTI)
  cd $GO_NIFTI
  nii_is=$(find $subjid -type f -name ${subjid}_T1.nii.gz)
  nii_i=${GO_NIFTI}${nii_is}

  cd $GO_B0
  cd $subjid
  GO_B0_2=$PWD
  b0_is=$(find . -type f -name b0.nii.gz)
  b0_i=${GO_B0_2}${b0_is}
  echo "-i arguments for $subjid is $nii_i and $b0_i"

  # -m argument (Mask File)
  #cd $GO_DTI
  #mask_ms=$(find $subjid -type f -name ${subjid}_tensor_mask.nii.gz)
  #mask_m=${GO_DTI}${mask_ms}
  #echo "-m argument for $subjid is $mask_m"

  # -fm argument (T1 mask)
  cd $GO_FM
  mask_fms=$(find $subjid -type f -name ${subjid}_t1_brain_mask.nii.gz)
  mask_fm=${GO_FM}${mask_fms}
  echo "-fm argument for $subjid is $mask_fm"

  # -o argument (Working Directory for possible debugging and tmp dir organization among experiments)
  cd $FINAL_DESTINATION
  g=${FINAL_DESTINATION:73:-1}
  experiment_name="${subjid}_${g}"
  mkdir $experiment_name
  output_o=${FINAL_DESTINATION}${experiment_name}/${experiment_name}_rigid.txt
  echo "-o argument for $g is $output_o"

  #

  printf "\nSubmitting the following command: \n
          qsub -m beas -M myname@medschool.edu -N Registration_${experiment_name} "$(which greedy)" -d3 -i $nii_i $b0_i -o $output_o -a -m MI -n 100x100 -fm $mask_fm dof 6 -ia-identity

          as JobID: Registration_${experiment_name}\n\n"

  qsub -v /medorg/software/external/greedy/centos7/c6dca2e -m beas -M myname@medschool.edu -N Registration_${experiment_name} "$(which greedy)" -d3 -i $nii_i $b0_i -o $output_o -a -m MI -n 100x100 -fm $mask_fm dof 6 -ia-identity

  # --- Above line submits Greedy Rigid jobs (dof 6) with
  # --- "-m" for emailing updates on jobs, inbox sorts job submission emails
  # --- "-N" names the job for book-keeping

  cd $GO_NIFTI

done

内容的提问来源于stack exchange,提问作者florence-y

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.21 16:40:14