Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 repl.it 上使用 Bash。我正在制作自己的命令行,我想知道如何从名为 commands 的文件夹中运行脚本。基本上,我想让一个文件从一个文件夹运行。我怎样才能做到这一点?
链接到我的repl
你能像这样运行它吗?
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.