如何使用 bash 中的安装将目录复制到目录中?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19136297/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 08:08:12  来源:igfitidea点击:

How to copy directories into a directory using install in bash?

linuxbashshellunixinstall

提问by mtsz

Assume the nested directories foo/barand a empty directory dest. I would like to call something like install foo destsuch that destcontains the directory foo/bar.

假设嵌套目录foo/bar和空目录dest。我想打电话给像install foo dest这样dest包含目录foo/bar

I have tried the following:

我尝试了以下方法:

install foo dest=> install: omitting directory "foo"

install foo dest=> 安装:省略目录“foo”

install -d foo dest=> nothing happens

install -d foo dest=> 什么也没发生

采纳答案by Paul Evans

You want to use cp -rinstead:

你想cp -r改用:

cp -r foo dest

回答by Alberto Salvia Novella

install -D "${origin}"/* -t "${target}"