Q:

Concatenating md5 string

I have a little script file called testing.sh where I am asking user to enter his login and password. Then, the password is getting encrypted with md5sum command and the result is stored in a file results.txt in a form login:md5password. However, when I am viewing the results.txt file, I only get login:, the encrypted password isn't concatenated. What am I doing wrong?
Here is the testing.sh file:
#!bin/bash
read -p 'Your login: ' uservar
read -sp 'Your password: ' passvar

var=$passvar|md5sum
echo $uservar:$var > ~/Desktop/results.txt

results.txt file:
login:

A:

You're doing var assignment in wrong way. 
var=$passvar|md5sum

You're supposed to send "$passvar" to md5sum. It won't go through pipe | by itself, so you either need to use echo, or printf. That will output things to stdout stream. You can capture that into variable with command substitution $(...). In other words, you should be doing:
var=$( echo "$passvar" | md5sum )

Also, please remember to quote the variables to preserve the integrity of data stored in them and prevent word splitting.

Other issues:
$ read -sp 'Your password:' passvar
Your password:$ var=$( echo "$passvar" | md5sum )
$ echo "$var"
2b00042f7481c7b056c4b410d28f33cf  -

Notice two things here: there's no newline after "Your password", so you might want to add echo after that command. Second, notice that md5sum outputs filename after the calculated md5 checksum, which in this case is - or stdin stream. You might want to consider getting rid of that part via any text processing utility that will let you cut away words, like awk:
var=$( echo "$passvar" | md5sum | awk '{print $1}')

Alternatively, you can just make use of bash's read and here-string <<< (see this for more info on that operator) :
$ read var trash <<< $( echo "$passvar" | md5sum )
$ echo "$var"
2b00042f7481c7b056c4b410d28f33cf

Last but not least, your #! line is missing / before bin - it should be #!/bin/bash.
The complete script should be as so:
#!/bin/bash
read -p 'Your login: ' uservar
read -sp 'Your password: ' passvar
printf "\n"
read var trash <<< "$(printf "%s" "$passvar" | md5sum)"
printf "%s:%s" "$uservar" "$var" #> ~/results.txt

Note that I commented out redirection to file, just to see the output on the terminal for testing purpose. Here's how it works:
$ ./testing.sh 
Your login: johndoe
Your password: 
johndoe:912ec803b2ce49e4a541068d495ab570$ 

For future reference, you can add set -x after #!/bin/bash (given that you've properly defined the #! line, of course) to troubleshot the script and see what commands actually run and were errors might arise. Or just use shellcheck online tool.

