Skip to content
Advertisement

How to stop ‘echo’ from caching

I run the following:

echo -n apache2.conf | sha256sum

>> 02b957c917c42d01d99ed42e020415b3d5049c4b8945c65363fa8467bb4e0c6e

I then make a change to the apache2.conf file and run the command again, expecting a different hash, however it is the same hash which leads me to believe that echo is caching the file in that shell memory. When I open new shell and take a hash of the now-modified file it shows new hash.

How can I clear echo’s cache or better still stop it from caching completely? Thanks.

Advertisement

Answer

echo will always print the name of the file which in your case is not changing.

Use cat command instead of echo to get the desired output.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement