Re: mkdir in shell script
Re: mkdir in shell script
- Subject: Re: mkdir in shell script
- From: Chuck Soper <email@hidden>
- Date: Mon, 23 Aug 2004 13:07:03 -0700
At 11:40 AM -0600 8/23/04, Nick Zitzmann wrote:
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
Nick,
Thanks for pointing me in the right direction. Unfortunately, I still
cannot get my script to work. I wasted about fifteen minutes
discovering that a shell script cannot have a blank line at that end.
The script below yields the following output:
inBuildPhaseShellScript
path:
mkdir: .: No such file or directory
I tried both /bin/sh and /bin/bash. I also tried adding 'export
destPath' after its assignment. I do have the book "Learning the bash
shell" and I briefly looked at the gnu site. Does anyone know what is
wrong with the script below?
Chuck
#the script:
echo "inBuildPhaseShellScript"
srcPath="$SRCROOT/data"
destPath="$TARGET_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/data123"
echo "path: $destPath"
if [ ! -d "$destPath" ]; then
mkdir "$destPath"
fi
_______________________________________________
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.