Post a reply

Write your message and submit

Options

Click in the dark area of the image to send your post.

Go back

Topic review (newest first)

emaxt6
2011-01-23 12:42:59

Create a simple and single script file, with all the command that you want to execute, and then invoke it in tsystem.

tsystem is not a shell enviroment, it just spawn a process.

kshitij_155
2011-01-22 20:51:22

Hi,

I'm trying to automate file-encryption using gpg encryption (password being passed automatically).

On Unix, the command to do so is:
(a)  echo <password> | gpg --batch -q --passphrase-fd 0 --symmetric --armor -c <file-to-encrypt>

OR, if the password is in a file (say, passFile.txt), then:

(b)  cat passFile.txt | gpg --batch -q --passphrase-fd 0 --symmetric --armor -c <file-to-encrypt>

I'm using tSystem component to call these commands.
So on Windows I'm using "cmd /c echo qwerty | gpg --batch -q --passphrase-fd 0 --symmetric --armor -c BB1.txt" which is working perfectly fine.

However, on Unix I've tries several ways but unable to get the desired result.

I've tried giving following in the tSystem:

(a) "echo qwerty | gpg --batch -q --passphrase-fd 0 --symmetric --armor -c BB1.txt"
--------------------
Result: It simply prints out the foll. on the console without doing anything:
qwerty | gpg --batch -q --passphrase-fd 0 --symmetric --armor -c BB1.txt


(b) "cat passFile.txt | gpg --batch -q --passphrase-fd 0 --symmetric --armor -c <file-to-encrypt>"
-------------------------
Result:
qwerty
cat: cannot open |
cat: cannot open gpg
cat: cannot open --batch
cat: cannot open -q
cat: cannot open --passphrase-fd
cat: cannot open 0
cat: cannot open --symmetric
cat: cannot open --armor
cat: cannot open -c
<file-contents are displayed>


I've been trying hard to figure out other ways by providing "exec" and by enclosing the command within `, but none of them have worked.

Can someone please advise?

Regards
Kshitij

Board footer

Powered by FluxBB