【工程 – Shell】Shell 学习([engineering shell] shell learning)

一次需求中我接触了maven,需要用maven去上传文件,上传5个文件虽然不多,但反复经过了多个版本之后是有点重复劳动。痛定思痛学习用shell去加速自己的工作。(PS:Maven发布快照结尾要大写的SNAPSHOT)

主要要用shell的数组(列表)

file_list=(
  file_name_1
  file_name_2
  file_name_3
)

for file_name in ${file_list[*]} do:
  mvn ***
done

注意这个语法很奇怪,赋值运算符两侧不能有空格。

————————

In one demand, I contacted Maven and needed to use Maven to upload files. Although there were not many uploaded five files, it was a little repetitive work after repeated versions. Learn from experience and learn to speed up your work with a shell. (PS: snapshot to be capitalized at the end of Maven release snapshot)

Mainly use shell array (list)

file_list=(
  file_name_1
  file_name_2
  file_name_3
)

for file_name in ${file_list[*]} do:
  mvn ***
done

Note that this syntax is strange. There can be no spaces on both sides of the assignment operator.