Forrest logo
back to the touch tool

touch:tldr:53417

touch: Set the file time of a specific file to the time of anothe[r] file and don't [c]reate file if it doesn't exist.
$ touch -c -r ${~--emacs} ${filename1 filename2 ---}
try on your machine

The command "touch -c -r ${~--emacs} ${filename1 filename2 ---}" performs the following actions:

  1. "touch" is a command used to modify file timestamps or create new empty files.
  2. The "-c" option instructs "touch" to not create new files if they do not already exist.
  3. The "-r" option is used to reference the timestamp of another file.
  4. "${~--emacs}" is a shell variable expansion that expands to the most recently modified file that matches the pattern "--emacs".
  5. "${filename1 filename2 ---}" is a list of files (filename1, filename2, etc.) that need to be updated.
  6. The command sets the timestamp of the files in the list (filename1, filename2, etc.) to match the timestamp of the most recently modified file that matches the pattern "--emacs". If the files do not exist, it does not create new files.

Note: The usage of "--emacs" in "${~--emacs}" suggests that it is a pattern used to filter files, and the most recently modified file matching that pattern is used as a reference for updating the timestamp of the given files. However, without more context or knowledge of the specific shell being used, it is difficult to determine the exact purpose or behavior of this command.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the touch tool