I'm trying to create a Bash script to calculate MD5 checksum of big files using different process. I learned that one should use &
for that purpose.
At the same time, I wanted to capture the results of the check sum in different variables and write them in file in order to read them after. So, I wrote the following script "test_base.sh" and executed it using the command "sh ./test_base.sh" and the results were sent to the following file "test.txt" which was empty.
My OS is LUBUNTU 22.04 LTS.
Why the "test.txt" is empty?
Code of the "test_base.sh":
#!/bin/bash
md51=`md5sum -b ./source/test1.mp4|cut -b 1-32` &
md52=`md5sum -b ./source/test2.mp4|cut -b 1-32` &
wait
echo "md51=$md51">./test.txt
echo "md52=$md52">>./test.txt
Result of "test.txt":
md51=
md52=