Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: newb commandline scripting and c/c++




Greetings.

Others have given good advice about steering clear of /usr/bin (nothing should ever be installed here -- it 'belongs' to the unix vendor), and shell scripting (the default OS X shell is zsh, which is of the sh/bash family, so a basic sh-scripting guide would apply).

However,

On 2008 Aug 24, at 16:38, Steve wrote:

I then opened a new file with vi calling it myc and I put the following line in it:
cd /Developer/sandbox/myc

The issue here is slightly subtle, and might not be apparent from the first pages of a scripting introduction, so it might be useful to explain it here.


Every (non-built-in) command you type starts a new child process, including the script which contains this line. When you invoked it, it created a new process, which was almost completely a copy of your existing process, and then it changed directory _within that process_. The script, and the process, then terminated, leaving the current directory in the parent unchanged. Check your sh-intro under the description of 'export' for environment variables.

All the best,

Norman


-- Norman Gray : http://nxg.me.uk Physics and Astronomy, University of Leicester

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden
References: 
 >newb commandline scripting and c/c++ (From: Steve <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.