Sponsored Content
Top Forums Programming Creating for loop for tar -tvf doesnt work Post 302998382 by robertkwild on Wednesday 31st of May 2017 09:02:20 AM
Old 05-31-2017
Creating for loop for tar -tvf doesnt work

hi all,

i have created a for loop, it looks like this -

Code:
#!/bin/bash
cd /mnt/local/data/tars
for tar in *
        do

        base=$(basename "$tar")

        "$base" -tvf >> /mnt/local/data/logs/"$base".csv

        done

but i get this error -

./tar_loop.sh: line 8: test1.tar: command not found
./tar_loop.sh: line 8: test2.tar: command not found
./tar_loop.sh: line 8: test3.tar: command not found
./tar_loop.sh: line 8: test4.tar: command not found
./tar_loop.sh: line 8: test.tar: command not found

so in my
Code:
cd /mnt/local/data/tars

i have the tar files above ie test1.tar and so on

why am i getting this error

many thanks,

rob
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

tar tvf from tape backeped using

Hi, The scenario is as follow: Backup was done using: tar cvf /dev/rmt/0mn file1.ext tar cvf /dev/rmt/0mn file2.ext tar cvf /dev/rmt/0mn file3.ext tar cvf /dev/rmt/0mn file4.ext tar cvf /dev/rmt/0mn file5.ext When I do; tar tvf /dev/rmt/0m, it only gives me the first file on the... (1 Reply)
Discussion started by: kong
1 Replies

2. UNIX for Dummies Questions & Answers

cd.. doesnt work

hi when i want to go to previous directory by typing cd.. i get the following message $ cd.. ksh: cd..: not found Please help rintingtong (2 Replies)
Discussion started by: rintingtong
2 Replies

3. HP-UX

ls command doesnt work

Good Day I mistakely renamed the dld.sl file in the /usr/lib directory. When i try to ls/ftp into the box i get this error :eek: crt0: ERROR couldn't open /usr/lib/dld.sl errno:000000002 I have tried to rename it back from the renamed file to the original file name, but it gives me the... (2 Replies)
Discussion started by: shawnbishop
2 Replies

4. UNIX for Dummies Questions & Answers

cp doesnt work - Help

When trying to copy a file in Solaris 8 it doesnt copy file or give a error. This worked 100% until the 29th. I've checked the rights and everything seems fine: drwxrwxrwx 2 bmuser bmgroup 11776 Jan 3 10:32 spool This is the file I want to copy: -rwxrwxrwx 1 bmuser bmgroup ... (26 Replies)
Discussion started by: rudi.okelly
26 Replies

5. Red Hat

ldapsearch doesnt work.

Hii All, I am using openldap v2.3 on redhat El-4. When i run ldapsearch it returns all the entries. The command runs successfully. But when I run the ldapsearch with following filter option it doesnt work and immediately returns to the shell. ldapsearch uidNumber>=2000 I've started slapd... (0 Replies)
Discussion started by: shamik
0 Replies

6. AIX

tar -xvf doesnt work

Hello Im trying to extract this file tar -xvf opt-samba-base.tar.tar tar: 0511-169 A directory checksum error on media; 0 not equal to 75420. but I get that message I tried algo with gunzip and uncompress but nothing happens gunzip -d opt-samba-base.tar.tar gunzip:... (2 Replies)
Discussion started by: lo-lp-kl
2 Replies

7. Shell Programming and Scripting

loop doesnt work

It just does the break...even though the files are not the same... # Compare extracts #========================================== count=0 while (( count < 5 )) do (( count+=1 )) echo "Try $count" file1=$(ls -l /tmp/psjava.xml|... (5 Replies)
Discussion started by: sigh2010
5 Replies

8. AIX

Vi doesnt work

Hi Guys, I have a strange problem.( AIX 6.1) "vi" is not working at all..Whenever i #vi <anythin> ,, it returns the prompt back. Any clues folks?? (14 Replies)
Discussion started by: muzahed
14 Replies

9. UNIX for Dummies Questions & Answers

why doesnt it work?

I am trying to print out two fields in a file using awk. So, I have got awk -F '\t' 'NF = 2 {print $1 $2 "]"}' two.txt in a script called what.awk When i run this version like this - ./what.awk then it runs however I want to run the program like this awk -f what.awk two.txt. When I... (8 Replies)
Discussion started by: The undertaker
8 Replies

10. Shell Programming and Scripting

Why doesnt if inside a while loop work ?

I am looping through a file in bash and performing some operations on it. Here is the code. cat test.dat - One Two Three Case 1: With if inside while loop Output: One file found :) ------------------ isn't it supposed to print following output !!! one (3 Replies)
Discussion started by: qwarentine
3 Replies
GPG-ZIP(1)							 GNU Privacy Guard							GPG-ZIP(1)

NAME
gpg-zip - Encrypt or sign files into an archive SYNOPSIS
gpg-zip [options] filename1 [ filename2, ... ] directory1 [ directory2, ... ] DESCRIPTION
gpg-zip encrypts or signs files into an archive. It is an gpg-ized tar using the same format as used by PGP's PGP Zip. OPTIONS
gpg-zip understands these options: --encrypt -e Encrypt data. This option may be combined with --symmetric (for output that may be decrypted via a secret key or a passphrase). --decrypt -d Decrypt data. --symmetric -c Encrypt with a symmetric cipher using a passphrase. The default symmetric cipher used is CAST5, but may be chosen with the --cipher-algo option to gpg. --sign -s Make a signature. See gpg. --recipient user -r user Encrypt for user id user. See gpg. --local-user user -u user Use user as the key to sign with. See gpg. --list-archive List the contents of the specified archive. --output file -o file Write output to specified file file. --gpg gpgcmd Use the specified command gpgcmd instead of gpg. --gpg-args args Pass the specified options to gpg. --tar tarcmd Use the specified command tarcmd instead of tar. --tar-args args Pass the specified options to tar. --version Print version of the program and exit. --help Display a brief help page and exit. EXAMPLES
Encrypt the contents of directory 'mydocs' for user Bob to file 'test1': gpg-zip --encrypt --output test1 --gpg-args -r Bob mydocs List the contents of archive 'test1': gpg-zip --list-archive test1 DIAGNOSTICS
The program returns 0 if everything was fine, 1 otherwise. SEE ALSO
gpg(1), tar(1), The full documentation for this tool is maintained as a Texinfo manual. If GnuPG and the info program are properly installed at your site, the command info gnupg should give you access to the complete manual including a menu structure and an index. GnuPG 2.0.15 2010-07-05 GPG-ZIP(1)
All times are GMT -4. The time now is 06:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy