Skip to main content
added 24 characters in body
Source Link
waltinator
  • 6.9k
  • 1
  • 25
  • 27

Your whole approach is suboptimal! Misuse of find, just checking if find says the file exists (or not, rather than if it's changed), ...

The file's existence (or not) can be checked with bash's [[ -f "/path/to/file" ]] exoressionconditional expression.

The file's "change date", or "modification time" is available from stat. See man stat.

An example of "monitor a file, do something when it changes", can be extracted from my net-o-matic script, available from https://github.com/waltinator/net-o-matic. IMHO it's a good lump of bash programming.

Your whole approach is suboptimal! Misuse of find, just checking if find says the file exists (or not, rather than if it's changed), ...

The file's existence (or not) can be checked with bash's [[ -f "/path/to/file" ]] exoression.

The file's "change date", or "modification time" is available from man stat.

An example of "monitor a file, do something when it changes", can be extracted from my net-o-matic script, available from https://github.com/waltinator/net-o-matic. IMHO it's a good lump of bash programming.

Your whole approach is suboptimal! Misuse of find, just checking if find says the file exists (or not, rather than if it's changed), ...

The file's existence (or not) can be checked with bash's [[ -f "/path/to/file" ]] conditional expression.

The file's "change date", or "modification time" is available from stat. See man stat.

An example of "monitor a file, do something when it changes", can be extracted from my net-o-matic script, available from https://github.com/waltinator/net-o-matic. IMHO it's a good lump of bash programming.

Source Link
waltinator
  • 6.9k
  • 1
  • 25
  • 27

Your whole approach is suboptimal! Misuse of find, just checking if find says the file exists (or not, rather than if it's changed), ...

The file's existence (or not) can be checked with bash's [[ -f "/path/to/file" ]] exoression.

The file's "change date", or "modification time" is available from man stat.

An example of "monitor a file, do something when it changes", can be extracted from my net-o-matic script, available from https://github.com/waltinator/net-o-matic. IMHO it's a good lump of bash programming.