I'm trying to create a function where I pass in 2 variables. First a string to be hashed, and then a variable to specify the kind of hash, md5
or sha1
. This is the function I created:
hashedWord () {
echo $1 > pw.txt && $2 pw.txt | cut -d ' ' -f 1
} > Desktop/hashedWord.txt
It is run as:
hashedWord aStringToHash, md5sum
where aStringToHash
is the $1
variable and md5sum
(a hashing variable) is $2
.
pw.txt
.