I am running my below shell script which gets the md5sum of a files in my PRIMARY directory #!/bin/bashexport PRIMARY=/data01/primaryfor entry in $PRIMARY/*do    local_md5sum=/usr/bin/md5sum $entry | awk '{print $1}'    echo local_md5sumdoneAs soon as I run above shell script and try to print out the md5sum value of my files, I always get - ./md5checksum_check_1.sh: line 7: /test01/prime/pp_monthly_1980_58_200003_5.data: Permission deniedBut if I try to run the below command as it is on the console then it works fine - /usr/bin/md5sum /test01/prime/pp_monthly_1980_58_200003_5.data | awk '{print $1}'I am not sure why? Is there anything wrong I am doing?
Permission denied while getting the md5sum of a file using shell script?
linux;bash;shell;hashsum
You're missing some syntax on this line:local_md5sum=/usr/bin/md5sum $entry | awk '{print $1}'You needlocal_md5sum=$(/usr/bin/md5sum $entry | awk '{print $1}')Without the $(), you are trying to execute $entry as a command.