title: Capturing bash history of piped scripts from within Perl or Ruby?
body: <p>If I run this command in bash shell:</p>
  
  <pre><code>script1 -i foo | script2 -i bar | script3 -i foobar
  </code></pre>
  
  <p>Is there a robust way to obtain that command as it would appear in bash_history from within script1-3? </p>
  
  <p>As far as I can tell, getting the information from the .bash_history file is no-go since writing to that file is buffered and it thus may be out of sync.</p>