Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

Shell script to check whether inputted directory is in current directory or not

Posted By: Luane Fischer     Category: Unix / Linux / Ubuntu     Views: 5184

Shell script to check whether inputted directory is in current directory or not

Code for Shell script to check whether inputted directory is in current directory or not in Unix / Linux / Ubuntu

for dir in `ls`
doif [ -d $dir ]
    then
        echo $dir
        cd $dir
        for i in `ls`
        doif [ -d $i ]
            then
                echo "      " $i
            fi
        done
        cd ..
    fi
done 
  
Share: 



Luane Fischer
Luane Fischer author of Shell script to check whether inputted directory is in current directory or not is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 

Other Interesting Articles in Unix / Linux / Ubuntu:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!