SoFunction
Updated on 2025-03-09

Shell script implementation detects whether the file has been modified and shared

Shell script implementation detects whether the file has been modified and shared

Updated: September 17, 2014 08:48:06 Submission: junjie
This article mainly introduces whether the detection file implemented by the Shell script is modified to share the code. In fact, if you understand the principle, you can do a lot of things. Friends who need it can refer to it.
#!/bin/bash
funmd5_1() {
find /root/passwd -type f | xargs md5sum > /tmp/funmd5_1.log
}
funmd5_2() {
find /root/passwd -type f | xargs md5sum > /tmp/funmd5_2.log
}
if [ ! -f /tmp/funmd5_1.log ];then
funmd5_1
fi
funmd5_2
diff /tmp/funmd5_1.log /tmp/funmd5_2.log > /tmp/
Status=$?
if [ $Status = 0 ];then
exit
else
echo "The file has been modified!"
fi

  • Shell
  • document
  • Whether to modify

Related Articles

  • How to get current stack information on Linux and Windows

    Below, the editor will bring you a method to obtain the current stack information on Linux and Windows. The editor thinks it is quite good, so I will share it with you now and give you a reference. Let's take a look with the editor
    2017-06-06
  • Detailed explanation of Linux ln commands

    Files in Linux are divided into Hard Link and Symbolic Link. Hard Link files are also called hard link files and entity link files, while Symbolic Link files are often called symbolic links and soft link files. This article mainly introduces the Linux ln command. Friends who need it can refer to it.
    2019-08-08
  • Shell script study guide[5](Arnold Robbins & Nelson H

    This article mainly introduces the shell script learning guide [5] (by Arnold Robbins & Nelson. Beebe). Friends who need it can refer to it.
    2014-02-02
  • Automatically restart the jar package's shell script simple example

    This article mainly introduces a simple example of shell script that automatically restarts the jar package. Friends in need can refer to it for reference. I hope it can be helpful. I wish you more progress and get promoted as soon as possible to get a salary increase as soon as possible.
    2023-08-08
  • Sharing of a Linux system security settings Shell script (for CentOS)

    This article mainly introduces a sharing of a shell script that sets the Linux system security. It is suitable for CentOS and contains most of the security settings. Just execute the script to get a relatively safe Linux system. Friends who need it can refer to it.
    2014-06-06
  • Linux users forcibly change initial password when logging in for the first time

    In a multi-user Linux environment, it is standard to create a user account that uses a random default password. After successful login, new users can change the default password to their own. For security reasons, it is often recommended to "force" users to change their default password after the first login to ensure that the initial one-time password is no longer used. Friends who need it can refer to it.
    2015-10-10
  • The difference between sed mode space and temporary storage space

    Many friends are not very clear about the difference between sed mode space and temporary storage space. Here is a brief introduction to it, which is convenient for friends who need it.
    2013-01-01
  • Detailed explanation of the example of decompression of linux. File

    This article mainly introduces the relevant knowledge of Linux decompression. The sample code in the article is concise and easy to understand. Interested friends can follow the editor to learn it.
    2023-08-08
  • Share the source code of ls command implemented in C language

    This article mainly introduces the sharing of the source code of the ls command implemented in C language. This article is a hand-training work for learning apue. Friends who need it can refer to it.
    2014-09-09
  • Collection of linux text processing tools and regular expressions

    This article mainly introduces the linux text processing tools and regular expression collections. It is very good and has reference value. Friends who need it can refer to it.
    2017-05-05

Latest Comments