linux - 如何创建特定用途的命令 shell

标签 linux shell command-line

我正在完成一项作业,但我似乎找不到任何有关如何完成它的“操作方法”示例。

我需要开发一个特定用途的命令 shell 来在至少有 2 个外部和内部命令的 Linux 系统上运行,例如 pwd、ifconfig。 shell 的目的是向 Linux 系统用户提供一组有限的功能。未指定语言。

我们之前没有获得任何可以使用的 Material ,所以我不知道如何做到这一点。任何帮助将不胜感激。

这是教授给出的“提示”:

"There are a number of different ways this assignment can be completed. Some can involve a combination of aliasing, shell scripts, using awk or modifying the tsh source."

最佳答案

使用此链接了解内部命令和外部命令之间的差异。 http://how-to.linuxcareer.com/internal-vs-external-linux-shell-commands

例如: 在~/.bashrc中

alias get_date "/tmp/script_1.sh"
alias current_date "/tmp/script_2.sh"

script_1.sh

time=$(current_date)

script_2.sh

date

并写入终端:

get_date

关于linux - 如何创建特定用途的命令 shell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33332278/

相关文章:

linux - 如何阻止访问特定网站

linux - 如何在 linux 中使用 ping 命令查找应用程序工作或关闭?

linux - 替换类文件的 Shell 脚本

C++计算CPU/内存使用情况

mysql - ODBC连接错误:No such command "odbc show" ODBC connection fail in asterisk*CLI

python - 将参数从 python 程序传递给 shell 脚本

c# - VS 2017 开发人员命令提示中的语言版本

node.js - Powershell不显示gulp任务的值

python - 在桌面上打开 Python IDE

linux - 如何在受限网络中拉取 docker 镜像