linux - 为什么在 shell 脚本中打印空路径?
问题描述
filter_option=" -name \"*\" "
file_paths=$(find "." -type f $filter_option)
echo find "." -type f $filter_option
echo $file_paths
samuel@:~/.../linux$ ./test.sh
找到 . -type f -name "*"塞缪尔@:~/.../linux$
我该如何解决这个问题以获得find . -type f -name "*"
's 结果?
解决方案
我建议使用数组:
filter_option=(-name '*')
file_paths=$(find "." -type f "${filter_option[@]}")
推荐阅读
- github - 如何将 Jitterbit 与 GitHub 或 Bitbucket 集成
- java - 升级依赖项后的 Java 版本错误
- merge - clickhouse:SYSTEM STOP MERGES 不起作用
- r - 如何在我的 R 包中使用 get0 仅在包命名空间中搜索?
- xamarin - Xamarin 形式的激光扫描解决方案
- reactjs - React Native 和 MobX:useContext 不会将更改重新渲染到屏幕上
- python - 2 个几乎相同的“hello world”Flask 应用程序,1 个有效,1 个返回 404 Not Found
- java - 使用排名数组查找优先级队列的最小/最大元素
- sas - 我的 SAS 代码出现错误,我可以寻求帮助吗?
- c++ - 协程参数的生命周期是多少