📌  相关文章
📜  shell 加载文件作为变量 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:49:50.495000             🧑  作者: Mango

代码示例1
# Basic syntax:
FILELINES=`cat your_file.txt`

# Example usage:
# Say you have a file "your_file.txt" containing the following sample names
# and you want to iterate over them in a bash script:
SAMPLE1
SAMPLE2
SAMPLE3
# The bash script would look like:
SAMPLES = `cat your_file.txt`
for SAMPLE in $SAMPLES; do
    echo $SAMPLE
done