if statement with md5sum not working correctly
Hello,
I am trying to use an if statement to check two files to see if they are the same using md5sum. The code below seems to me to be fine, but when I run it, the output is always "The files are the same", even when I deliberately make them different. Why is this? Code:
if ["$(md5sum file2)" != "$(md5sum file2)"]; then Code:
[227ba58f8f59da4329683682565b1e4f: command not found |
Hi,
you need a space after '[' and before ']'. '[' is a synonym for the 'test' command. Code:
if [ "$(md5sum file2)" != "$(md5sum file2)" ]; then |
Quote:
|
All times are GMT -5. The time now is 12:30 PM. |