found no way to manage Log files / Dynamic Files (whose content are changing continuously ) #2969
-
First and foremost, I would like to express my deepest appreciation and gratitude for the incredible project that you have developed. Your efforts have helped me overcome numerous challenges, and I cannot thank you enough for your hard work. Currently, I am facing a minor issue related to the project's documentation, which I'm sure is already addressed in it. I am trying to manage an XML file in my Linux machine, but I want to ignore every change made by the operating system. Specifically, when I run $ chezmoi apply, it shouldn't show I have attempted to implement a solution where, if the file exists, it is ignored, and if it does not exist, it is added to the specified location. However, I am encountering an issue with the fileExists function not being defined. Here's the code I tried:
The error message I receive is: the only content of the file in which i only want to track changes
but after some time OS made changes to the file and this becomes this
where numeric values are changing continuously and it show me the message that file has been changes Additionally, I'm also wondering if it's possible to only track changes made to a specific line or word of code within the XML file. I believe it could be achieved through the use of I have thoroughly reviewed the project documentation, which is incredibly well-written, but due to my limited understanding of Go, I'm having difficulty comprehending how to implement these changes. Any assistance you can provide in resolving this issue would be greatly appreciated. Thank you again for your hard work and dedication to this project. I look forward to hearing back from you soon. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Thanks for the kind words. The For your use case, it is likely that a |
Beta Was this translation helpful? Give feedback.
-
The function you’re looking for is
Nominally this could be done with a #! /usr/bin/env bash
set -euo pipefail
declare thunar
thunar="${HOME}/.config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml"
# This should *probably* be "${XDG_CONFIG_HOME}/xfce4/…", but expanded out for now.
if [[ -s "${thunar}" ]]; then
xmlstarlet ed --inplace -P \
--update '//channel/property[@name="last-show-hidden"]/@value' --value true \
--update '//channel/property[@name="misc-show-delete-action"]/@value' --value true \
"${thunar}"
else
cat >"${thunar}" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<channel name="thunar" version="1.0">
<property name="last-show-hidden" type="bool" value="true"/>
<property name="misc-show-delete-action" type="bool" value="true"/>
</channel>
EOF |
Beta Was this translation helpful? Give feedback.
The function you’re looking for is
stat
, which returnsnull
if the file does not exist.