Solved

How to write a script for PGP encryption in unix

Posted on 2013-06-26
1
772 Views
Last Modified: 2013-06-27
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
Comment
Question by:ra100020
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 24

Accepted Solution

by:
fridom earned 500 total points
ID: 39280926
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question