bash - 如何在 bash 中打开文件夹中的文件?
问题描述
我在 repl.it 上使用 Bash。我正在制作自己的命令行,我想知道如何从名为 commands 的文件夹中运行脚本。基本上,我想让一个文件从一个文件夹运行。我怎样才能做到这一点?
解决方案
你能像这样运行它吗?
sh commands/${input}.sh
此外,您应该能够 push/pop dir 进入/退出目录。
pushd commands
# adds cwd into a stack and goes to <dir> commands/
sh $input.sh
popd
# goes back to last dir in stack.
推荐阅读
- javascript - 单击事件javascript / jquery多次加载相同的脚本
- abap - 用户出口中的测试失败时取消 Post Good Issue 的处理
- c# - 引用不存在项目的外键
- asp.net-core-2.0 - 无法让 Identity Server 启动默认主页
- php - 获取用户在联系表 7 中上传的文件的 url
- java - 我正在尝试将我的控制器实例传递给另一个控制器,但它返回 null
- c++ - Scope of heap memory allocated with new in c++
- c# - 网络 C# 日期时间转换
- javascript - 我想通过单击 ci 中的下载按钮下载 zip 文件中的所有图像
- javascript - 具有多个值的自动完成字段(可移除)