![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Writing shell script | bmkreddy | Shell Programming and Scripting | 2 | 04-15-2007 12:04 PM |
| Difference between writing Unix Shell script and AIX Shell Scripts | haroonec | AIX | 0 | 04-11-2006 11:27 PM |
| Need help for writing shell script | deepa20 | Shell Programming and Scripting | 3 | 02-01-2006 10:23 AM |
| Need Help Writing Shell Script***please | KristenT | Shell Programming and Scripting | 7 | 01-31-2006 03:00 PM |
| Writing a shell Script | Chin | UNIX for Dummies Questions & Answers | 1 | 06-03-2005 01:32 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Writing a shell script to untar files
I am new to shell scripting and would appreciate any help I can get.
I need to write a Unix shell script that I will run whenever I have a tar file to uncompress(Korn shell). Please put in mind that I have different environements that I will run it on. Thanks in advance |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
First off, please start new threads in an appropriate forum. You posted this into the "Post Here to Contact Site Administrators and Moderators" I moved it to "Shell programming and scripting Q & A" Thanks.
How do you do it manually? Shell scripting is taking what you do everyday, putting it into a script so you don't have to type as much (typing the same thing every day will normally lead to errors and then more typing). Code:
#!/bin/ksh
# This script should be run with a parameter (the tar file you want to extract)
if [ "$1" = "" ]
then echo "Must run script with tar file name"
else
tarfile=$1
tar xf $tarfile
fi
exit
Last edited by RTM; 08-17-2005 at 08:43 PM. |
|
#3
|
|||
|
|||
|
Thank you for your explanation and help
|
|
#4
|
|||
|
|||
|
Still having problems/Not getting right results
The purpose of the script is to untar a file that contains directories
The tar file is created on a first box(main server) after a major delivery using FTP and I want to update the second box(failover server). Part of the script that I have is # Auxiliar variables Tarfile=$parm_env`date '+%Y%m%d'`dir.tar #Change directory to main product area echo "cd $MAIN_PA" #Uncompress the tar file if [ $Tarfile = "" ] then $UTILDIR/SLX_Alert.sh $parm_env $thispgm "'Tar file does not exist'" -1 else tar xf $MAIN_PA/$Tarfile fi $parm_env is the environment $thispgm is the title of the script $MAIN_PA is th path where the tar file is located Thank you Last edited by nkem22; 08-22-2005 at 02:38 PM. Reason: Needed to explain better |
|
#5
|
|||
|
|||
|
As an aside, you should look into rsync. It's a wonderful, speedy program to keep files and directories in sync.
|
|||
| Google The UNIX and Linux Forums |