简体   繁体   中英

Bash script md5sum

i have problem

My input file:

user1 password1
user2 password2

How to get in output

user1 paassword1  d857ed4f845fce06fbc5bb76
user2 password2   e10adc3949ba59abbe56

I use

md5=$(md5sum "$1" | cut -d ' ' -f 1)

but I do not know what's next

#! /bin/bash
while read -r user passwd ; do
    md5=$(printf %s "$passwd" | md5sum | cut -c1-32)
    printf '%s %s %s\n' "$user" "$passwd" "$md5"
done

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM