我想在Mnetgen的帮助下创建Multicommodity Min Cost Flow实例,但我遇到了名为“batch”的文件问题,其第一行由
# Batch file for generating MMCF problems with the mnetgen random generator # # For each n in {64, 128, 256} generates 12 instances for each pair (n, k) # with k in {4, 8, 16 , ... , n}, using as input the parameters found # in pr{n}.{k}/{n}-{k}-{h}.inp for h in {1, ... , 12}. The instances # are left in the directory pr{n}.{k} # # At the end of the file, commented out, there are the instructions for # generating the groups with n = 512 and n = 768: in the latter case, # however, only 6 instances for each group are generated. # # In a Unix environment, simply type "source batch" or "csh < batch" foreach i ( 64 ) foreach j ( 4 8 16 32 64 ) foreach h ( 1 2 3 4 5 6 7 8 9 10 11 12 ) mnetgen pr$i.$j/$i-$j-$h.inp pr$i.$j/$i-$j-$h end end end ...到目前为止我做了什么? 首先,我将#include <cstring>添加到mnetgen.c以避免错误。 然后我输入make来获取可执行文件mnetgen 。 最后一步是使用批处理文件生成实例。
使用上一个评论行中的提示,我得到了
bash: batch: Zeile 14: Syntaxfehler beim unerwarteten Wort »(« bash: batch: Zeile 14: 'foreach i ( 64 )'
要么
mnetgen: Command not found.
我该如何解决这个问题?
I want to create Multicommodity Min Cost Flow instances with the help of Mnetgen but I have problems with the file called "batch" whose first lines are given by
# Batch file for generating MMCF problems with the mnetgen random generator # # For each n in {64, 128, 256} generates 12 instances for each pair (n, k) # with k in {4, 8, 16 , ... , n}, using as input the parameters found # in pr{n}.{k}/{n}-{k}-{h}.inp for h in {1, ... , 12}. The instances # are left in the directory pr{n}.{k} # # At the end of the file, commented out, there are the instructions for # generating the groups with n = 512 and n = 768: in the latter case, # however, only 6 instances for each group are generated. # # In a Unix environment, simply type "source batch" or "csh < batch" foreach i ( 64 ) foreach j ( 4 8 16 32 64 ) foreach h ( 1 2 3 4 5 6 7 8 9 10 11 12 ) mnetgen pr$i.$j/$i-$j-$h.inp pr$i.$j/$i-$j-$h end end end ...What did I so far? First I added #include <cstring> to mnetgen.c to avoid errors. Then I typed make to get an executable file mnetgen. The last step would be to generate the instances by using the batch-file.
Using the hint in last comment line I get either
bash: batch: Zeile 14: Syntaxfehler beim unerwarteten Wort »(« bash: batch: Zeile 14: 'foreach i ( 64 )'
or
mnetgen: Command not found.
How can I fix that?
最满意答案
您正在尝试在bash中运行csh shell。
要解决这个问题,请运行
csh myshell或添加第一行:
#!/bin/csh运行命令时,Unix / linux将检查第一行,它将被视为一种幻数,并以/bin/csh前缀。
(有更好的方法可以使用#!/bin/env csh )
对于未找到的mnetgen命令,我建议您在脚本中添加命令的完整路径或将其添加到系统PATH中。
You are trying to run a csh shell in bash.
To fix that, either run
csh myshellor add on the first line:
#!/bin/cshWhen running your command, Unix/linux will check the first line which will be seen as a kind of magic number and will prefix it by /bin/csh.
(there are better ways to do that maybe with #!/bin/env csh)
and for your mnetgen command which is not found, I suggest that you add the full path of your command in your script or add it to the system PATH.
更多推荐
发布评论