Sponsored Content
Homework and Emergencies Homework & Coursework Questions Trouble with Shell Script Compressing file Post 302961413 by Luvs2drnk on Saturday 28th of November 2015 04:53:18 PM
Old 11-28-2015
Trouble with Shell Script Compressing file

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:
You will create a shell script that performs the following action:
  • Use a parameter to pass a file that contains a list of file locations.
  • Read the list of file locations and store it as a variable
  • Using the list of file location create a compressed file, do not show any output from this command
  • Display the contents of the compressed file
  • Display the size of the newly created compressed file
Keep getting the following errors/outputs:
tar: Removing leading `/' from member names
tar: /phager/Desktop: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors

The script still creates the compression file, but when I try to display the file size and file name with the stat command I get more info than I want, all I need to display is the file size and name after the echo command "The size of file1.tgz is:"


2. Relevant commands, code, scripts, algorithms:
Code:
#!/bin/bash
echo "Creating Compressed File from file1"
while read $file1; do
echo "Contents of file are:"
cat file1
tar cvzf file1.tgz /phager/Desktop
echo "The size of file1.tgz is:"
stat file1.tgz
done < file1


3. The attempts at a solution (include all code and scripts):



4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Leeward Community College, Pearl City, HI, USA, Peter Gross, ICS240, https://www.sis.hawaii.edu/uhdad/ava...201610&c=55462

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

compressing two files in a script

Hi, i have written a script in unix which produces two files(.csv file) at the end. Now i want to add these to files in a zip file and send the zip file across the network by FTP. Problem is that i dunno how to make a single zip file containing the two files that have been created by the script.... (1 Reply)
Discussion started by: nimish
1 Replies

2. Shell Programming and Scripting

Trouble using substr function with Bourne shell script

Hi, I'm a newbie to UNIX scripting and I'm having some trouble compiling my script. I'm using the Bourne Shell and cannot seem to use the substr function correctly. I'm trying to extract the last two digits of a year that's stored in a variable based off of a condition. I've searched the... (4 Replies)
Discussion started by: E2004
4 Replies

3. Shell Programming and Scripting

Reading/Compressing of log file

Hello All Posted a similar thread in some other section too. Regrets if this section is not suitable for this post. Request all the members to be tolerant as i'm a newbie here :) Coming to the topic : I've this huge log files of size 20GB-30 GB in my unix server. I want to analyse the log... (2 Replies)
Discussion started by: sgbhat
2 Replies

4. Shell Programming and Scripting

Is there any way to find the compressed size of a file without compressing it in linux

i need to backup a directory from one partition to another and and compress that directory after backing up, so i need to predict the compressed size of the directory with out actually compressing it, to check whether the space is available in the destination partition to accommodate the zipped... (2 Replies)
Discussion started by: Kesavan
2 Replies

5. Homework & Coursework Questions

Trouble with Advanced Shell Programming

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I am working on a hands on project. We are creating a script for a corporate phone list. The project I am... (2 Replies)
Discussion started by: SarahBelle7858
2 Replies

6. Shell Programming and Scripting

Changing the file name while compressing

Hi, Is there any way to change the file name while compressing ? using Compress and gzip and tar ? Say, I have a file foo.txt - so I have to compress this file and the resultant file name is foo.txt_20130113.gz or foo.txt_20130113.Z This to be done while performing the compression... (2 Replies)
Discussion started by: karumudi7
2 Replies

7. Homework & Coursework Questions

Linux/UNIX Bash Shell Script trouble help needed!!

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 2. Shell Bash Script 3. !/bin/bash if echo no directory then mkdir -p /home/AC_Drywall elif ; then echo "$dir already exist" fi (4 Replies)
Discussion started by: TomFord1
4 Replies

8. Shell Programming and Scripting

Compressing old files as zip file through script

I have below files in foler one/archive> one. txt 6/21/2013 two txt 7/23/2013 three.txt 6/20/2013 I wanted to move all the old files (>30 days) compressing single .zip file into one/archive/ as below two txt 7/23/2013 oldfiles.zip 6/21/2013 Please provide... (6 Replies)
Discussion started by: Ganesh L
6 Replies

9. Shell Programming and Scripting

Tcsh Shell trouble

Need assistance in getting a solution for a TCSH shell environment variable . I read on internet that leading zeros as octal numbers and redhat doesnt supports octals but Solaris works on TCSH shell. Is there any way we can fix this . All my script has 08 or 09 $ @ x = 5 + 08 @: Badly formed... (8 Replies)
Discussion started by: ajayram_arya
8 Replies

10. Shell Programming and Scripting

Help with Shell Scrip in Masking particular columns in .csv file or .txt file using shell script

Hello Unix Shell Script Experts, I have a script that would mask the columns in .csv file or .txt file. First the script will untar the .zip files from Archive folder and processes into work folder and finally pushes the masked .csv files into Feed folder. Two parameters are passed ... (5 Replies)
Discussion started by: Mahesh G
5 Replies
atfsit(1)							    ShapeTools								 atfsit(1)

NAME
atfsit - A program to prepare files for version control SYNOPSIS
atfsit [ -cFhfsmM ] [ -qad ] [ -Iflags ] [ -Rflags ] [ -tdirectory ] file1 ... DESCRIPTION
Atfsit is a semi-intelligent program to prepare files for ShapeTools version control. This involves putting the correct type of headings at the top of the file so that retrv will update a header and log changes in the file. By default, atfsit will use default headers ``hard-wired'' into itself for each different file type that it ``knows'' about. (See below for list of known file types). If the -tdirectory option is specified, then atfsit will use ``.template.suffix'' files (where ``suffix'' is a suffix that atfsit ``knows'' about) found in directory. If a directory name is not specified on the command line, then the environment variable TEMPLATES is used. If $TEMPLATES is not set, then the environment variable, HOME is tried. The following template files are recognized: Template NameFile Type --------------------------------------- .template.c Standard C .template.h C Include .template.f Fortran .template.shShell Script .template.makeMakefile .template.manManual Atfsit is ``semi-intelligent'' in that it can guess the type of headers to put in the file by the type of file (C program, C include, make- file, shell script, or manual). It determines the file type by looking at the name of the file. If the name of the file is ``Makefile'' or ``makefile'', then the file type is taken to be for make(1). The suffix after the last ``.'' in the file name is then used. The fol- lowing table shows the suffixes that atfsit knows about: Suffix File Type --------------------------------------------- c C Program F C Program (with compile flags) h C Include f Fortran mk Make(1) file sh Shell Script csh Shell Script [1-9] Manual (digits 1 - 9) If the environment variable ``ATFSDIR'' is present, then atfsit will attempt to make a link from it to ``AtFS'' in the current directory if the -I option is used and there is no directory called ``AtFS'' already, in the current directory. If the -I option is used and ``ATFS- DIR'' is not specified in the environment, then a normal directory called ``AtFS'' will be created. This feature can be overrided with the -d option. OPTIONS
c Force file type to be ``Standard C''. F Force file type to be ``Standard C''. Add a special header-line for recording of compile-time options in addition to the default header. The inserted line has the form static char *ConfFlg = CFFLGS. CFFLGS must be a string value. As it is very inconve- nient, to define the proper value of CFFLGS from the command-line, this feature is more intended to be used from within Make- files. h Force file type to be ``C Include''. f Force file type to be ``Fortran''. M Force file type to be ``Manual''. Note: If you also specify the ``Iflags'' option, atfsit will run vadm(1) to tell ShapeTools what kind of comment string to use for the manual file. s Force file type to be ``Shell Script''. m Force file type to be ``Makefile''. Note that this does the same thing as the -s option does. It just prints a different mes- sage. t Do not use any Template files for the headers. q Be quiet. Don't print out what is going on. Only error messages are printed. d Do not attempt to make the directory ``AtFS''. See above for more info. a Turn off auto guessing of file type. Iflags Check In file. Run save(1) on the file with ``flags'' being passed onto save(1) as the command line arguments. Rflags Run vadm(1) with ``flags'' as the command line arguments. FILES
/tmp/atfsit* - temporary buffer ~/.template.* - template files to use as the header. AUTHOR
Michael Cooper (mcooper@usc-oberon.ARPA) Modified for use with ShapeTools by Axel.Mahler@cs.tu-berlin.de SEE ALSO
save(1), vadm(1), retrv(1). DIAGNOSTICS
Complains about the usual stuff. (i.e. - the specified file doesn't exist, or it can't read it...just things like that.) atfsit-1.15 Tue Jun 29 16:29:16 1993 atfsit(1)
All times are GMT -4. The time now is 03:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy