12-06-2014, 06:25 AM
Possible, but I keep it in the right-click menu
Name: SHA1
Description: Calculates SHA1 sum.
Command: /usr/scripts/sha1 %f
Pattern: *
Files: Check all the boxes except Directories
save the script as sha1
make executable
copy the file to /usr/scripts
And md5sum
Name: MD5
Description: Calculates MD5 sum.
Command: /usr/scripts/md5 %f
Pattern: *
Files: Check all the boxes except Directories
save the script as md5
make executable
copy the file to /usr/scripts
It's better to use * as a pattern because that way you can calculate the sum of any file.
P.S. I hope this version works for rokytnji.
Name: SHA1
Description: Calculates SHA1 sum.
Command: /usr/scripts/sha1 %f
Pattern: *
Files: Check all the boxes except Directories
save the script as sha1
make executable
copy the file to /usr/scripts
Code:
#!/bin/bash
sha1_file="$@"
# Start sha1sum of a selected file
sha1sum "$sha1_file" | tee >(cut -d ' ' -f1 > /tmp/sumsh1) |zenity --progress --title="SHA1" --text="Calculating sha1sum for:\n${sha1_file##*/}" --pulsate --auto-close
# If Cancel is clicked then remove temporary file and exit
if [ "${PIPESTATUS[2]}" -ne "0" ]; then
rm /tmp/sumsh1
exit 0
fi
# Display calculated md5sum
sum=`cat /tmp/sumsh1`
zenity --info --title="SHA1" --text="SHA1sum : $sum\nFile : ${sha1_file##*/}"
rm /tmp/sumsh1
And md5sum
Name: MD5
Description: Calculates MD5 sum.
Command: /usr/scripts/md5 %f
Pattern: *
Files: Check all the boxes except Directories
save the script as md5
make executable
copy the file to /usr/scripts
Code:
#!/bin/bash
md5_file="$@"
# Start MD5sum of a selected file
md5sum "$md5_file" | tee >(cut -d ' ' -f1 > /tmp/sum) |zenity --progress --title="MD5sum" --text="Calculating md5sum for:\n${md5_file##*/}" --pulsate --auto-close
# If Cancel is clicked then remove temporary file and exit
if [ "${PIPESTATUS[2]}" -ne "0" ]; then
rm /tmp/sum
exit 0
fi
# Display calculated md5sum
sum=`cat /tmp/sum`
zenity --info --title="MD5sum" --text="MD5sum : $sum\nFile : ${md5_file##*/}"
# echo $sum > "$md5_file".md5sum
rm /tmp/sum
P.S. I hope this version works for rokytnji.