The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
question about testing in shell programming thungmail Shell Programming and Scripting 6 04-09-2008 11:04 AM
question about testing in shell programming(modifications were made) thungmail Shell Programming and Scripting 2 04-08-2008 12:51 PM
question about testing in shell programming thungmail Shell Programming and Scripting 3 04-05-2008 07:29 AM
question about testing in shell programming thungmail Shell Programming and Scripting 3 04-02-2008 07:46 PM
question about about Shell programming thungmail Shell Programming and Scripting 1 04-01-2008 10:40 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-07-2008
Registered User
 

Join Date: Apr 2008
Posts: 11
question about testing in shell programming

I have 2 different directories. The first has 2 sub-folders A and B. The second as 2 sub-folders C and D and script named "script".There is a code of "script" to list 2 sub-folders C and D
Code:
#!/bin/sh
for file in *
do [ -d $file ]  && echo $file
done
I would like to ask how can I make a change if I would like to list 2 sub-folders A and B in the first directory ( using "script" )
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 04-07-2008
Registered User
 

Join Date: Sep 2006
Location: Mysore, India
Posts: 155
Run the script from the parent directory of A & B, or provide absolute path in for condition like:
Code:
for file in /home/user1/mydir/*
Reply With Quote
  #3 (permalink)  
Old 04-07-2008
Registered User
 

Join Date: Apr 2008
Posts: 11
@krishmaths:thanks a lot. it works
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:49 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0