我在编程方面很新。以下任务看起来很简单,但我不知道该怎么做。感谢是否有人可以给我一些指导。
我正在使用 Linux 操作系统。我想创建一个 CLI 程序并让用户在 shell 终端中运行它。我打算使用 Bash shell 脚本来创建这个程序,但是 C++ 或 Perl 也应该可以。CLI 程序将接受来自用户的命令,执行它,然后选择性地在屏幕上显示结果摘要。
当 CLI 程序运行时,我想让它总是在 shell 终端的左侧显示一个“shell 提示符”,就像 Bash shell 提示符一样。该提示表示 CLI 程序正在等待用户输入命令并按回车键。
[AAA@Bash user]$ # This is Bash shell
[AAA@Bash user]$./CliApp.sh
CliApp > # The CLI program is running, user can type in command here
CliApp > exit
[AAA@Bash user]$ # Now the user has returned to the Bash shell
我想我知道如何在屏幕上打印一些东西并从用户那里获得输入,但我发现它看起来很不专业。我相信有更好的方法来创建这种程序。
谁能给我一些指导如何创建这种程序?感谢您是否可以给我任何示例程序的链接。谢谢。