• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: mkdir in shell script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mkdir in shell script


  • Subject: Re: mkdir in shell script
  • From: Nick Zitzmann <email@hidden>
  • Date: Mon, 23 Aug 2004 11:40:18 -0600

On Aug 23, 2004, at 10:29 AM, Chuck Soper wrote:

What is the proper way to create a sub-directory via a shell script build phase? I'd like to write: if sub-directory doesn't exist then mkdir path. Can someone help me with this Unix command? (I think I could always call mkdir and have it error out 99% of the time, but that doesn't seem very clean to me.)

Assuming you're using Bash as your shell, the Bash documentation is a good reference for this sort of thing: <http://www.gnu.org/software/bash/manual/bashref.html>


Anyway, you can do this by doing something like this in a Bash shell script: (warning - written in Mail, untested)

if [ ! -d "${TARGET_BUILD_DIR}/The/Rest/Of/The/Path" ]; then
	mkdir "${TARGET_BUILD_DIR}/The/Rest/Of/The/Path"
fi

Nick Zitzmann
<http://seiryu.home.comcast.net/>
S/MIME signature available upon request

"They [our enemies] never stop thinking about new ways to harm our country and our people, and neither do we. We must never stop thinking about how best to offend our country." - George W. Bush (August 5, 2004)
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.



  • Follow-Ups:
    • Re: mkdir in shell script
      • From: Chuck Soper <email@hidden>
References: 
 >mkdir in shell script (From: Chuck Soper <email@hidden>)

  • Prev by Date: Relative Paths?
  • Next by Date: Build fails, can't find file. Double-click file and it opens.
  • Previous by thread: Re: mkdir in shell script
  • Next by thread: Re: mkdir in shell script
  • Index(es):
    • Date
    • Thread