Thread: question about testing in shell programming

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    41

    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" )

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    find .. -type d
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. shell script basic question
    By PedroTuga in forum Linux Programming
    Replies: 1
    Last Post: 09-09-2006, 03:24 AM
  2. Testing user input question?
    By Hoser83 in forum C Programming
    Replies: 18
    Last Post: 02-15-2006, 01:18 PM
  3. Hi everyone..Testing strings and if question
    By tinkerbell20 in forum C++ Programming
    Replies: 7
    Last Post: 06-21-2005, 06:23 AM
  4. Question type program for beginners
    By Kirdra in forum C++ Programming
    Replies: 7
    Last Post: 09-15-2002, 05:10 AM
  5. shell scripts?
    By Unregistered in forum Linux Programming
    Replies: 1
    Last Post: 05-06-2002, 05:43 AM