files=(
file1 file2 "the goose incident.png"
"another file"
file3 file-4 "fifth file" file6
"this is file7 with a
newline in the middle of the name" )
cd ~/dir1 &&
cp "${files[@]}" ~/dir2
Это скопирует имена, упомянутые в списке files
, из ~/dir1
в ~/dir2
.
Новые строки между элементами в списке files
не важны, за исключением новой строки в последнем элементе, который представляет собой имя файла с внедренной в него новой строкой (просто для того, чтобы показать, что вы также можете иметь их, без вопросов ).
Список можно было бы и написать
files=(
file1
file2
"the goose incident.png"
"another file"
file3
file-4
"fifth file"
file6
"this is file7 with a
newline in the middle of the name"
)
или как
files=( file1 file2 "the goose incident.png" "another file" file3 file-4
"fifth file" file6 "this is file7 with a
newline in the middle of the name" )