onFileSystemChange
Add a filesystem watch
onFileSystemChange
events are triggered whenever there is a change to a watched path or file.
event onFileSystemChange name=path { code block }
!event onFileSystemChange name
<path>
Path of directory or file to watch for filesystem eventsThe following payload is passed to the function via stdin:
{
"Name": "",
"Interrupt": {
"Path": "",
"Operation": ""
}
}
This is the name you specified when defining the event
The path of the file that has triggered the event
This is the filesystem operation that triggered the event. The following strings could be present in the Operation field:
create
: filesystem object createdremove
: filesystem object deletedwrite
: filesystem object has been written torename
: filesystem object has been renamedchmod
: filesystem object has had its POSIX permissions updatedSometimes you might see more than one operation per interrupt. If that happens the operation will be pipe delimited. For example create|chmod
This event doesn’t have any $EVENT_RETURN
parameters.
This will automatically add any new files in your current working directory to git upon file creation:
event onFileSystemChange example=. {
-> set event
if { $event.Interrupt.Operation =~ "create" } then {
git add $event.Interrupt.Path
}
}
Stdout and stderr are both written to the terminal.
At this stage, this event isn’t available for Windows nor Plan 9. This is chiefly down to a lack of testers on either platform so rather than release untested and potentially broken code, the decision was made to restrict this event to Linux, macOS and UNIX systems instead.
event
): Event driven programming for shell scriptsconfig
): Query or define Murex runtime settingsThis document was generated from builtins/events/onFileSystemChange/onfilesystemchange_doc.yaml.
This site's content is rebuilt automatically from murex's source code after each merge to the master
branch. Downloadable murex binaries are also built with the website.
Last built on Tue Dec 10 22:56:57 UTC 2024 against commit 60f05a260f05a227caf73dd5b3478e3cb3f4bb24e46745b.
Current version is 6.4.1005 (develop) which has been verified against tests cases.