0

For my project purpose I want to write a shell script program which runs in the background and acts as a listener to a specified avi file. When that avi file is played from terminal my script file my script file should get notified and executes certain commands before that avi file is played. Can I achieve this with the help of trap command or some other trick could be used.

user269270
  • 171
  • 1
  • 1
  • 4
  • I don't think trap does what you think it does. This kind of functionality is outside the scope of a shell script. What's the problem you're actually trying to solve? There may be a better way to go about it. – Brent Apr 18 '14 at 21:28
  • 1
    This smells of sniffing on user actions... – arkascha Apr 18 '14 at 21:29
  • This is ultimately platform specific, but on linux you can use the inotify mechanism. Some more tools included a python wrapper and OSX possibilities at http://stackoverflow.com/questions/6963423/how-to-achieve-linuxs-inotify-tools-shell-methods-on-osx – Chris Stratton Apr 18 '14 at 22:19

0 Answers0