Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Terminal set:变量名必须以字母开头_Terminal_Csh - Fatal编程技术网

Terminal set:变量名必须以字母开头

Terminal set:变量名必须以字母开头,terminal,csh,Terminal,Csh,这是我的代码,如何将k设置为比j小17。 它给出了错误: set:变量名必须以字母开头 #! /bin/csh -ef set j = 18 while ($j <= 40) set k = $j-17 set i = 18 while ($i <= 40) set l = $i - 17 echo $i $j|gmx mindist -f 10ns_bit_45deg_LC3-v2.xtc -s for_prod2

这是我的代码,如何将k设置为比j小17。 它给出了错误: set:变量名必须以字母开头

#! /bin/csh -ef

    set j =  18
    while ($j <= 40)
    set k = $j-17
    set i = 18
    while ($i <= 40)
    set l = $i - 17
        echo $i $j|gmx mindist -f 10ns_bit_45deg_LC3-v2.xtc -s for_prod2_POPC_24LC3-45deg.tpr -n LC3_protein_index.ndx -xvg none -od distance_p$l-LC3p$k.xvg -o distance_p$l-LC3p$k.out
    #   echo 17 14|g_dist -f ../../combined_trr/comb_10micro_LC3_310_1136lipids_MDSIM$j.trr -s ../cgmdsim1_1mer_LC3_310K_1136lipids.tpr -n GLP_a286.ndx -xvg none -o dist_protein_POPC_traj$j.xvg 
    #   awk ' { print $1, $5 }' dist_glp_protein_POPC_traj$j.xvg >zaxisdist_glp_protein_POPC_traj$ju.xvg

@ j++
@ i++

    end

exit -1
#/bin/csh-ef
设置j=18

虽然($j我不知道为什么您会收到这个特定的错误消息

set: Variable name must begin with a letter.
csh的语法没有得到很好的定义,解析器可能会变得混乱

但问题是

 set l = $i - 17
将不执行减法。正确的语法为:

@ l = $i - 17
另一个问题:脚本中有两行
while
,但只有一行对应的
end
——如果使用一致的缩进,则更容易发现此错误。

尝试以下操作: @k=$j-17
因为使用减法运算,所以必须使用@

来表示tcsh,所以我认为变量后面的空格是问题所在

set xyz ="asd" --> gives the same error 

set xyz="asd"  --> work all well 

您需要查看减法的正确语法。您不能在尝试设置时设置
k
l
。这是csh还是bash?选择一个shell和一个标记,并使用它。提示:如果您重视内心的平静,请不要选择csh。