Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.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
如何在shell命令中将值从文件传递到参数?_Shell - Fatal编程技术网

如何在shell命令中将值从文件传递到参数?

如何在shell命令中将值从文件传递到参数?,shell,Shell,我正在学习如何在unixshell中创建脚本。我有一个基因组坐标列表,我想将其作为值传递给命令行。例如,我有文件Chr1.txt: Chr1 10 450 Chr1 456 890 ... shell命令是: maf_parse --start *value1* --end *value2* 我希望使用Chr1.txt中的start($2)和end($3)坐标迭代运行shell命令。我有大约1000个条目 while read chr1 start end do

我正在学习如何在unixshell中创建脚本。我有一个基因组坐标列表,我想将其作为值传递给命令行。例如,我有文件
Chr1.txt

Chr1   10    450
Chr1   456   890
...
shell命令是:

maf_parse  --start *value1*   --end *value2*
我希望使用
Chr1.txt
中的start(
$2
)和end(
$3
)坐标迭代运行shell命令。我有大约1000个条目

while read chr1 start end
do
    maf_parse --start "$start" --end "$end"
done < Chr1.txt

3
的意思是使用文件描述符3而不是0(标准输入)作为输入文件描述符。这使程序能够读取标准输入(如果需要)。

非常感谢!我不明白最后的while read -u 3 chr1 start end file junk do maf_parse --start "$start" --end "$end" > "$file" done 3< Chr1.txt