Re: Shell Script on a string
Re: Shell Script on a string
- Subject: Re: Shell Script on a string
- From: Axel Luttgens <email@hidden>
- Date: Mon, 18 Nov 2002 22:21:14 +0100
Hudson Barton wrote:
At 6:35 PM +0100 11/16/02, Axel Luttgens wrote:
Hudson Barton wrote:
I have a shell script as follows:
"set this_result to do shell script ("/usr/bin/openssl sha1 " &
this_File) as string"
I need to know how to run the same routine on a text segment rather
than on a file. Obviously, I'm inexperienced in working with
Terminal-like commands.
"openssl sha1" expects some text on its standard output or, if specified
as an argument, in a file.
So, you could use "echo" and pipe its output to openssl's input:
set myText to "aaa" -- the string to digest
do shell script ("echo '" & myText & "' | openssl sha1")
OK. That's excellent. Now I want to do one that requires entering a
password (an encryption routine), but I can't get the syntax right.
Here's what I have:
set x to (do shell script ("echo '" & myText & "' | openssl bf -salt
-pass pass:" & Password1 & ""))
After some trials, I think that the "-e" option (for "encrypt") is missing.
But please doublecheck: this time, I'm more or less guessing...
HTH,
Axel
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.