Loop through an array of strings in Bash?

前端 未结 19 2779
情深已故
情深已故 2020-11-22 03:59

I want to write a script that loops through 15 strings (array possibly?) Is that possible?

Something like:

for databaseName in listOfNames
then
  # D         


        
相关标签:
19条回答
  • 2020-11-22 04:34

    This is similar to user2533809's answer, but each file will be executed as a separate command.

    #!/bin/bash
    names="RA
    RB
    R C
    RD"
    
    while read -r line; do
        echo line: "$line"
    done <<< "$names"
    
    0 讨论(0)
提交回复
热议问题