I can run some Shell Linux commands in Perl (for example create a folder). But I can't execute followed command:
echo 'mypassword' | gpg --passphrase-fd 0 --output outfile --decrypt inputfile
I add this command in .sh file and could execute in Shell fine. but when I call .sh file, Perl couldn't run it. I used open3
, system
, open
commands to run. I could run other .sh file, but not for this command.
Can you help me please?
Try using backquote/backtick, seems to work fine:
#!/usr/bin/perl
use strict;
`echo 'mypassword' | gpg --passphrase-fd 0 --output outfile --decrypt inputfile`
PS I would better use some cpan module like GPG .
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.