title: Get Current Command In Linux
body: <p>I'm creating a shell script that will always read the user's current commands from the shell.</p>
  
  <p>I'm currently using the <code>read</code> command which I'm not satisfied with since it is used for prompting questions. Example:</p>
  
  <pre><code>root@hostname: ./script.sh
  Question here?
  answer - `read` command 
  </code></pre>
  
  <p>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).</p>
  
  <pre><code>root@hostname: read the command here
  result will happen
  </code></pre>
  
  <p>My example script <code>myapp.sh</code>:</p>
  
  <pre><code>#!/bin/bash
  if [ "input" = "value"]
  then
      do some actions
  fi
  </code></pre>