• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1031
  • Last Modified:

How to write a script for PGP encryption in unix

Hi All,
 Can someone help me to write a script in unix which has to pick a file from a directory,encrypt the file using PGP commands and place it in the destination directory?

I am new to scripting to unix and PGP

Appreciate your help,

Thanks and Regards,
0
ra100020
Asked:
ra100020
1 Solution
 
fridomCommented:
Well it depends on what Shell you like to use. How do you want to add the directories?

int the end you need something like

#!/usr/bin/zsh

source_directory="/usr/local/tmp"
target_directory="/tmp"
source_file="$1"

gpg --output "$target_directory/$source_file.gpg" --encrypt -r recipient $source_file  

Open in new window


It's up to you to improve on the user interface. Printing help etc. But this should give you an idea.

Regards
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now