LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-14-2007, 10:53 PM   #1
JenniJenni
LQ Newbie
 
Registered: Aug 2007
Posts: 14

Rep: Reputation: 0
script help


#!/bin/bash
export FILE_NAME=$1
echo "$FILE_NAME">> cash_out
date >> /xyz/cash_out.out
gpg -e -u "622455DE" -r "44B6A97D" $FILE_NAME >> cash_out


Could you please explain the above script please.

Thanks
 
Old 08-14-2007, 11:11 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
It seems pretty straight forward, outputting every line to the file cash_out, including the first argument ($1), the date, and the file (specified as $1) encrypted to the GPG key 44B6A97D and signed with the key 622455DE.
 
Old 08-14-2007, 11:16 PM   #3
JenniJenni
LQ Newbie
 
Registered: Aug 2007
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks a lot matir.

I am new to linux. Could please explain me one more time in detail. I would greatly appreciate your help.

Thanks again
 
Old 08-14-2007, 11:19 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Is there any part about which you are confused?
 
Old 08-14-2007, 11:29 PM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Is this homework? What books on BASH and scripting have you read.
The point is that we need to know where to start....

For example
The first line tells the system to run this script using the program "bash" which is found in /bin.
The second line sets a variable (FILE_NAME) to the value of the first argument passed to the script when it is called.
The third line gets the value of FILE_NAME and redirects it to a file named "cash_out". It is appended to this file.
In the fourth line, there may be an error. It is appending the output of the date command to a different file (cash_out.out) Also the /xyz/ path tells me that this is an example script and not a real one.

Do you know what the script is supposed to do??

One more tip: when learning bash scripting, try the commands one at a time to get a feel for how they work
 
Old 08-14-2007, 11:42 PM   #6
JenniJenni
LQ Newbie
 
Registered: Aug 2007
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks a lot Pixallany.

I need to get a file from a Mainframe system and this file needs to be encrypted before we send it to our supplier.

You have educated me everything, except the last line

gpg -e -u "622455DE" -r "44B6A97D" $FILE_NAME >> /xyz/cash_out



could you please walk me thru what exactly is happening in the above statement

Thanks a lot.
 
Old 08-15-2007, 06:57 AM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by JenniJenni View Post
could you please walk me thru what exactly is happening in the above statement
Thanks a lot.
But you didn't answer MY questions!!!
Matir already explained the last line:
Quote:
encrypted to the GPG key 44B6A97D and signed with the key 622455DE.
For the details of the gpg command, do "man gpg"
 
Old 08-15-2007, 08:13 AM   #8
JenniJenni
LQ Newbie
 
Registered: Aug 2007
Posts: 14

Original Poster
Rep: Reputation: 0
The script is suppose to get a file from the Mainframe system and then encrypt that file and send it to our supplier, thats the objective of the script.

Thanks again.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Iptables (with masq) troubleshooting, very simple script attached script and logs. xinu Linux - Networking 13 11-01-2007 04:19 AM
i get an error message running php script inside a cgi script. repolona Linux - Software 0 02-22-2007 09:10 PM
How to start a Tcl/Tk script by simply invoking the script file itself ? cyu021 Programming 2 10-10-2004 11:00 AM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM
linux 9 and java script error - premature end of script header sibil Linux - Newbie 0 01-06-2004 04:21 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration