inotify and bash

前端 未结 3 1452
忘了有多久
忘了有多久 2020-12-08 14:35

I am trying to make a bash script with inotify-tools that will monitor a directory and alter all new files by removing lines containing \"EE\". Once altered it will move the

3条回答
  •  一个人的身影
    2020-12-08 14:58

    Quoting the man page of inotifywait:

    inotifywait will output diagnostic information on standard error and event information  on
       standard  output.  The event output can be configured, but by default it consists of lines
       of the following form:
    
       watched_filename EVENT_NAMES event_filename
    
       watched_filename
              is the name of the file on which the event occurred.  If the file is a directory, a
              trailing slash is output.
    

    In other words, it prints the names of the files to standard output. So, you need to read them from standard output and operate on them to do what you want to do.

提交回复
热议问题