The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sending mail parmeet UNIX for Dummies Questions & Answers 11 05-13-2009 04:37 AM
hp ux not sending mail kkhan HP-UX 3 01-31-2008 11:27 PM
Mail sending panknil Shell Programming and Scripting 15 09-19-2007 02:24 AM
Sending mail thru HP-UX medisetti HP-UX 1 02-22-2007 07:08 PM
sending a mail to a mail client solaris73 UNIX for Dummies Questions & Answers 5 11-18-2002 01:58 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-18-2008
vscott vscott is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 2
Help with GPG Scripting and sending mail when done!!!

I am very new to linux so please explain things to me like I was not from this world. I never wanted to learn linux, but since the other IT person is gone, I was the only one left. So now I have been messing around with it alot, and I really like it. Bought a few books, and CBT's to get use to it, and I absolutely love it, though my games don't work, I can live without them for now.

Anyways, I am making a script to decrypt a file and then send an email when done. The thing is I want to keep this as close to automatically as possible. So the next person won't need to fuss about the long process of our loads.

So my first problem is displaying the files with certain credentials, then moving all previous files to a backup folder. Our clients sometimes sends us two files, but the latest one is the one we need to process. But I can not even get this program to display all the files.

Then after displaying it move the old files to backup and only have the newest file.

I have this so far:

#!bin/bash

# Check directory for all rabadd*.gpg
if [ -e /home/eacsci1/rabadd*.gpg ]; then
echo "rabadd encrypted file(s) exist"

# Locate and display files with name rabadd and ext .gpg. Then clear when done.
find -maxdepth 1 -name rabadd*.gpg > rabadd.txt ; cat rabadd.txt ; rm rabadd.txt.
# In case the encrypted file does not exist, let user know.
else
echo "rabadd encrypted file(s) not found!"

fi
  #2 (permalink)  
Old 06-18-2008
jim mcnamara jim mcnamara is online now Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,813
here is a start:

Code:
#!bin/bash

# Check directory for all rabadd*.gpg

filefound=$(ls /home/eacsci1/rabadd*.gpg > 2>&1 > /dev/null; echo $?)
if [ $filefound -eq 0 ]] ; then
   echo "rabadd encrypted file(s) exist"

# Locate and display files with name rabadd and ext .gpg. Then clear when done.

   find -maxdepth 1 -name rabadd*.gpg -exec ls -l {} \;

# In case the encrypted file does not exist, let user know.

else
   echo "rabadd encrypted file(s) not found!"
fi

  #3 (permalink)  
Old 06-18-2008
vscott vscott is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 2
Ok I added the script you mention besides


Code:
[ $filefound -eq 0 ]]

I think this should only have one bracket, right?

Anyways it still produces an error message that I can not interpret


Code:
./prep_down.sh: command substitution: line 14: syntax error near unexpected token `2'
./prep_down.sh: command substitution: line 14: `ls /home/eacsci1/rabadd*.gpg > 2>&1 > /dev/null; echo $?'
./prep_down.sh: line 16: [: -eq: unary operator expected
rabadd encrypted file(s) not found!

I will change it up and get some understanding of this part, until someone can point out the issue here.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:11 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0