我正在创建一个shell脚本,该脚本将始终从shell读取用户的当前命令。在Linux中获取当前命令
我目前使用的read
命令,我不满意,因为它用于提示问题。例如:
[email protected]: ./script.sh
Question here?
answer - `read` command
我希望在用户直接输入命令行命令(脚本通过/etc/profile.d/myapp.sh已经运行一次登录)要调用的我的脚本。
[email protected]: read the command here
result will happen
我的示例脚本myapp.sh
:
#!/bin/bash
if [ "input" = "value"]
then
do some actions
fi
你知道'bash' shell的'source'和'eval'内建函数吗? –
不...对于缺乏知识感到抱歉 – BLNK
阅读http://www.tldp.org/LDP/abs/html/ –