Find in this group all groups
Unknown more information…

l : 11 March 2008 • 9:27PM -0400

Re: Automatic CTRL-D (EOF)
by Jose Celestino


Words by Mário Gamito [Tue, Mar 11, 2008 at 01:07:54PM +0000]:
> Hi,
> I have a script that has to perform a hash over a password.
> Problem is that sha512sum expects CTRL-D to be pressed to return to the
> command prompt.

No, it just expects EOF.

> I've searched all over Google, but either I didn't use the right search
> strings or there is nothing relevant about this.
> Bottom line is that I need this command to print the password hash and
> returns to the shell automatically:
> $ sha512sum | xargs echo "password" | cut -f2 -d' '
> Tried:
> $ read x; echo "$x" |  sha512sum | xargs echo "password" | cut -f2 -d' '
> but no good and as a bonus (NOT) the hash is incorrect.

That is because echo adds a \n at the end of the string.

You should also do a silent read (-s):

read -s ; echo -n "$REPLY" | sha512sum | xargs echo "password"

Jose Celestino
----------------------------------------------------------------     ;
"If you would have your slaves remain docile, teach them hymns."
    -- Ed Weathers ("The Empty Box")
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger...
More majordomo info at

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.