I'm creating a shell script that will always read the user's current commands from the shell.
I'm currently using the read
command which I'm not satisfied with since it is used for prompting questions. Example:
root@hostname: ./script.sh
Question here?
answer - `read` command
I want the my script to be invoked when the user directly inputs a command on the command line (the script is already running through /etc/profile.d/myapp.sh once logged in).
root@hostname: read the command here
result will happen
My example script myapp.sh
:
#!/bin/bash
if [ "input" = "value"]
then
do some actions
fi