![]() |
|
|
|
|
|||||||
| 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 |
| please explain the below | mail2sant | Shell Programming and Scripting | 1 | 04-04-2008 05:04 AM |
| Please can any one explain this ${0##/} | gadege | Shell Programming and Scripting | 2 | 04-01-2008 12:26 PM |
| Can anyone explain plz | r_W213 | UNIX for Advanced & Expert Users | 3 | 03-27-2007 01:52 AM |
| if [ $? -eq 0 ] .. can someone explain this? | ranjita.c | Shell Programming and Scripting | 5 | 10-03-2006 04:50 PM |
| Explain awk | hitmansilentass | Shell Programming and Scripting | 4 | 09-27-2006 11:14 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
can u explain this step by step........plz...will it do the same
for I in *.tar.gz; do A=`basename $I .tar.gz` mkdir $A cp marking-guide ${A}/$A cd $A gunzip -c ../$I | tar xf - cd.. done thnx __________________ |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
# loop thru all zip file archives (files ending .tar.gz)
for I in *.tar.gz; do # set var A to whatever is before the .tar.gz A=`basename $I .tar.gz` # make a directory for the var A mkdir $A # copy file marking-guide to __ cp marking-guide ${A}/$A # change directory to A cd $A # unzip __ gunzip -c ../$I | tar xf - # change directory to one back cd.. # done with loop done |
|
#3
|
|||
|
|||
|
For each filename ending in .tar.gz (gzipped tar file)
for I in *.tar.gz; do Filename without any path (including the .tar.gz) A=`basename $I .tar.gz` Make a directory with the same name as the file mkdir $A Copy something called marking-guide into the new directory with the same name as the .tar.gz file cp marking-guide ${A}/$A Move into the directory and decompress the file cd $A gunzip -c ../$I | tar xf - Go back to the original directory in case there are more iterations of the loop cd.. done |
|||
| Google The UNIX and Linux Forums |