小编Jor*_*ner的帖子

将回声输出列表保存到 .txt

我在尝试将一长串回声输出保存为桌面上的 .txt 文件时遇到了很多麻烦。我在优胜美地 10.10.4 中使用 Bash。我对 Bash 还是很陌生,所以感谢任何帮助和提示。

目标是打印每次脑部扫描使用的协议的名称,以获得一长串脑部扫描。我使用了一个 for 循环来递归地遍历每个脑部扫描,提取使用的协议,然后回显它以及用于获取该信息的确切文件的路径。

我的脚本:

for i in /Path/to/scans/
do

for file in "$i/"001*/0001.dcm
do

# If there is no such file here, just skip this scan.
if [ ! -f "$file" ]
then
echo "Skipping $i, no 0001.dcm file here" >&2
continue
fi

# Otherwise take the protocol data from scan out
line= dcmdump +P 0040,0254 0001.dcm 
## dcmdump is the command line tool needed to pull out this data. 
## In …
Run Code Online (Sandbox Code Playgroud)

bash shell-script

2
推荐指数
1
解决办法
1341
查看次数

标签 统计

bash ×1

shell-script ×1