Sponsored Content
Top Forums Shell Programming and Scripting Need to decrypt a file in a directory (SHL script) Post 302474196 by DGPickett on Tuesday 23rd of November 2010 02:30:32 PM
Old 11-23-2010
Use the Code tags button left of <> above so it looks like this:
Code:
$!/usr/bin/ksh
 .
 .
 .
# Start Decrypt Process
# Determine if there is a file to process 
for $FileName in *.dat.pgp
do
  if [ "$FileName" = '*.dat.pgp' ] # no files
  then 
    exit
  fi
 
  if [ "$(fuser $FileName 2>/dev/null)" !="" ]
  then 
    date "+%Y-%m-%d %H:%M:%S $FileName is in use"
    continue 
  fi

  gpg -o #FileName -d > $LocalDir

  if [ $? = 0] 
  then 
  else 
    date "+%Y-%m-%d %H:%M:%S error decoding $FileName"
  fi
done

Find is overkill if the files are all in one or a few directories. I never liked the find -exec option, as you do not have good error handling when unattended. You can "find | while read f ; do done" and check for errors, have a separate log for each conversion, etc. Not sure what "$FileName find" does! You can detect unexpanded wild cards easier as above. Not sure what the gpg command line is up to, but most of the line is a weird #comment, work on that. You, too deserve structural indentation and blank lines for easy visual separation of complex constructs.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Encrypt and Decrypt script

Dear Experts, I am using one script name :volume.sh and its written in bash shell script. I just want to encrypt the script so that any one else cannot see it. please tell me the commands how to encrypt the script as well as to decrypt it. Regards, SHARY (9 Replies)
Discussion started by: shary
9 Replies

2. Shell Programming and Scripting

shl script capture a file

need to be able to capture a file with the following conditions: The filenames are, for example, 3526_332840.dat, where 3526 is constant, and 332840 is a sequential number which is always a couple hundred greater than the previous day's file. I want to be able to change this script to acoomplish... (1 Reply)
Discussion started by: rechever
1 Replies

3. UNIX for Advanced & Expert Users

Decrypt a GPG file through shell script

Hi, I'm trying to decrypt a gpg file thorugh a shell script. But i' could'nt. My script is , -sh-3.1$ cat test_gpg.sh #!/bin/ksh echo " Hello, iam testing GPG" gpg prabhu.txt.gpg <<EOF prompt prabhu EOF exit 0 The file i'm trying to decrypt is prabhu.txt.gpg and my passphrase is... (1 Reply)
Discussion started by: apsprabhu
1 Replies

4. Shell Programming and Scripting

Reading a file (one record) in a SHL script

I am trying to read a file in a shl script (only one record) and stored in a variable file_number I got the following read -u $BANNER_HOME/xxxxxxx/misc/EFTSQL.dat file_number file_number2 = $file_number + 1 echo $file_number2 > $BANNER_HOME/xxxxxx/misc/EFTSQL.dat EOF It is not working... (2 Replies)
Discussion started by: rechever
2 Replies

5. Shell Programming and Scripting

Renaming a file use another file as a sequence calling a shl

have this shl that will FTP a file from the a directory in windows to UNIX, It get the name of the file stored in this variable $UpLoadFileName then put in the local directory LocalDir="${MPATH}/xxxxx/dat_files" that part seems to be working, but then I need to take that file and rename, I am using... (3 Replies)
Discussion started by: rechever
3 Replies

6. Shell Programming and Scripting

This code works in the command line but not in a shl script

When I run this code from the command line works spinel.middlebury.edu:/u02/sct/banner/bandev2/middlebury/shl:DEV2$ ls ef* eftseq.dat spinel.middlebury.edu:/u02/sct/banner/bandev2/middlebury/shl:DEV2$ file_seq=$( < eftseq.dat) ... (1 Reply)
Discussion started by: rechever
1 Replies

7. Shell Programming and Scripting

last file in a directory in a shl script

I want to capture a last file in a directory in a shl scrip Cd to the directory $last ls -1 *the_bills.dat* | tail -1 This is not problem, but I need to copy that file to another directory, but in order to be able to copy to that directory, I need to su in unix, I am sure my sistem... (2 Replies)
Discussion started by: rechever
2 Replies

8. Shell Programming and Scripting

gzip and encrypted in a shl script

After I move the file to a directory, I need to gzip and encrypted. I never do this in a shl script, I do it from the command line and it works.. cd /home/nelnet spinel:/home/nelnet$ gpg -e 2010_11_07_05_11_xxxxxx_bills.dat.gz `/home/nelnet/.gnupg/gpg.conf' `/home/nelnet/.gnupg/gpg.conf'... (3 Replies)
Discussion started by: rechever
3 Replies

9. Shell Programming and Scripting

Problems coping a file in a shl script

I have the following in a shl script: SCRIPT_PATH="/u01/app/banner/test/skid/plus/"; FILE_PATH="/nfs/mercury/u03/banner/test/skid/log"; LIST_FILE_PATH="/u01/banjobs/TEST"; SCRIPT_NAME="szpcal1.sql"; FILE_NAME='new_applicant_list'; I want to copy the file FILE_NAME to LIST_FILE_PATH ... (10 Replies)
Discussion started by: rechever
10 Replies

10. Shell Programming and Scripting

Encrypt Password file and decrypt in a shell script

Hi All, I have stored Oracle database passwords in a hidden file - .pass_file. My shell script reads the hidden file, gets the password and then logs in to the Oracle database and runs some SQL script. My requirement is: I need to provide the shell script to be executed by someone else. So,... (1 Reply)
Discussion started by: sunpraveen
1 Replies
MEDIAINFO(1)							   User Commands						      MEDIAINFO(1)

NAME
MediaInfo - command line utility to display information about audio/video files MediaInfo-Gui - graphical utility to display information about audio/video files SYNOPSIS
mediainfo [-Options...] FileName1 [Filename2...] mediainfo --Inform=FMT FileName mediainfo-gui [-Options...] FileName1 [Filename2...] mediainfo-gui --Inform=FMT FileName DESCRIPTION
MediaInfo supplies technical and tag information about a video or audio file What information can I get from MediaInfo? - General: title, author, director, album, track number, date, duration... - Video: codec, aspect, fps, bitrate... - Audio: codec, sample rate, channels, language, bitrate... - Text: language of subtitle - Chapters: number of chapters, list of chapters What format does MediaInfo support? - Video: MKV, OGM, AVI, DivX, WMV, QuickTime, Real, MPEG-1, MPEG-2, MPEG-4, DVD (VOB)... - Video Codecs: DivX, XviD, MSMPEG4, ASP, H.264, AVC... - Audio: OGG, MP3, WAV, RA, AC3, DTS, AAC, M4A, AU, AIFF... - Subtitles: SRT, SSA, ASS, SAMI... What can I do with it? - Read many video and audio file formats - View information in different formats (text, sheet, tree, HTML...) - Customise these viewing formats - Export information as text, CSV, HTML... - Graphical Interface, Command Line, or library versions available OPTIONS
MediaInfo supports the following case-insensitive options: --Help, -h Display help and exit --Help-Inform Display help for --Inform option --Help-AnOption Display help for "AnOption" --Version Display MediaInfo version and exit --Full, -f Full information Display (all internal tags) --Output=HTML Full information Display with HTML tags --Output=XML Full information Display with XML tags --Inform=FMT Template defined information display. FMT is "[xxx;]Text", where xxx can be any one of General, Video, Audio, Text, Chapter, Image, or Menu. Text can be the template text, or a filename in the form of file:///path See --Info-Parameters for available parameters in the text. Parameters must be surrounded by "%". --Info-Parameters Display list of --Inform parameters --Language=raw Dislpay non-translated unique identifiers (internal text) --LogFile=LogFile Save the output in LogFile EXAMPLES
Display information about a video file $ mediainfo foo.mkv Display aspect ratio $ mediainfo --Inform="Video;%DisplayAspectRatio%" foo.mkv $ mediainfo --Inform="Video;file://Video.txt" foo.mkv Both forms are equivalent if Video.txt contains: %DisplayAspectRatio% Display aspect ration and audio format $ mediainfo --Inform="file://Text.txt foo.mkv If Text.txt contains: - "Video;%DisplayAspectRatio%" Then the display aspect ratio is printed out. - "Audio;%Format%" Then the audio format is printed out. AUTHOR
This manual page was written by Chow Loong Jin <hyperair@debian.org> for the Debian system (but may be used by others). Permissions is granted to copy, distribute, and/or modify this document under the terms of the GNU General Public License, Version 3 or any later version published by the Free Software Foundation. On Debian systems, the full text of the GNU General Public License, Version 3 can be found in /usr/share/common-licenses/GPL-3. MediaInfo 0.7.52 2012-06-03 MEDIAINFO(1)
All times are GMT -4. The time now is 09:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy