diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2019-11-22 02:14:25 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2019-11-22 11:13:34 +0530 |
commit | 1cca9e4b72b106374f203890b266f18609deefe3 (patch) | |
tree | 9f281f4b4de296c54d13dc9c7e214f58835636a7 /plugins/checksum | |
parent | ee2dcb1de7d3e82b330f49ee9fb5dfd4608207ff (diff) | |
download | nnn-1cca9e4b72b106374f203890b266f18609deefe3.tar.gz |
shellcheck fixes
Diffstat (limited to 'plugins/checksum')
-rwxr-xr-x | plugins/checksum | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins/checksum b/plugins/checksum index 2040e68..0c13da2 100755 --- a/plugins/checksum +++ b/plugins/checksum @@ -21,8 +21,8 @@ chsum=md5 checksum_type() { echo "possible checksums: md5, sha1, sha224, sha256, sha384, sha512" - echo -n "create md5 (m), sha256 (s), sha512 (S) (or type one of the above checksums) [default=m]: " - read chsum_resp + printf "create md5 (m), sha256 (s), sha512 (S) (or type one of the above checksums) [default=m]: " + read -r chsum_resp for chks in md5 sha1 sha224 sha256 sha384 sha512 do if [ "$chsum_resp" = "$chks" ]; then @@ -38,8 +38,8 @@ checksum_type() } if [ -s "$selection" ]; then - echo -n "work with selection (s) or current file (f) [default=f]: " - read resp + printf "work with selection (s) or current file (f) [default=f]: " + read -r resp fi if [ "$resp" = "s" ]; then @@ -49,10 +49,10 @@ elif [ -n "$1" ]; then if [ -f "$1" ]; then for chks in md5 sha1 sha224 sha256 sha384 sha512 do - if [ "$(echo "$1" | grep \.${chks}$)" ]; then + if echo "$1" | grep -q \.${chks}$; then ${chks}sum -c < "$1" - read dummy - exit + read -r _ + return fi done checksum_type |