The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to check if all directories of file's path exists? MartyIX Shell Programming and Scripting 2 08-19-2008 03:31 PM
Find a file in sub-directories.. o/p just the path pranavagarwal Shell Programming and Scripting 3 11-23-2007 01:50 AM
Bash Script to display directories in Path? debut Shell Programming and Scripting 1 11-09-2005 05:06 PM
How to create directories abishekmag UNIX for Dummies Questions & Answers 3 03-21-2005 01:34 PM
How do I create & Maintain directories kimjones142001 UNIX for Dummies Questions & Answers 4 09-10-2001 05:40 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-21-2008
Llb Llb is offline
Registered User
  
 

Join Date: Nov 2008
Location: Bangalore,India
Posts: 13
Want to create 3 different new directories under the same path

Hi,
Iam new to UNIX...My requirement is to create 3 dir as an hierarchy under /var/opt/temip.The output should be /var/opt/temip/GP_Int/GPTTS/AUTO.
I have tried the following script...But only GP_int folder is getting created and not other folders...Can someone help???
#!/usr/bin/ksh
#script to create directory structure.
filename=/var/opt/temip
echo $filename
dirname=GP_Integration
echo $dirname

if [ -d $dirname ]
then
echo "directory exists already"
else
mkdir -p $(dirname $filename)
echo "directory GP_Integration created"

filename=/var/opt/temip/GP_Integration
echo $filename
dirname=GPTTS
echo $dirname
if [ -d $dirname ]
then
echo "directory exists already"
else
mkdir -p $(dirname $filename)
echo "directory GPTTS created"
fi

fi
Thanks...
  #2 (permalink)  
Old 11-21-2008
Konerak Konerak is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 20
First of all, just "mkdir -p /var/opt/temip/GP_Int/GPTTS/AUTO" should work. The -p switch will suppress errors if the dirs exist and create the parents.

Reply if you need more help. You confused me a bit with "filename" and "dirname" by using a directory as filename...
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:30 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0