[CentOS] Scripting a directory change on CentOS

Tue Jul 31 22:10:07 UTC 2007
William L. Maltby <CentOS4Bill at triad.rr.com>

On Mon, 2007-07-30 at 12:49 -0400, James B. Byrne wrote:
> <snip>


> I have to work with a long path to a project working directory and I would
> like to have a simple script called "current" which would produce the same
> effect as issuing this from the shell:
> 
> cd ./very/long/path/to/obscurely/titled/project/directory
> 
> I cannot seem to find anything that directly addresses this, other than to
> point out that shell scripts run in their own copy of the shell
> interpreter and so anything done to the PWD therein is local to the
> duration of the script.  I could create a logical link from my home
> directory I suppose, but I desire a scripted solution.
> 
> I really do not wish to program a utility to do this and I cannot believe
> that many people have not already addressed this desire with a straight
> forward answer. So if any of you have a simple to implement solution then
> could you share your answer with me?
> 
> As I am a digest subscriber in addition to your answer to the list the
> favour of a direct reply is requested
> 
> Sincerely,
> 

In addition to the other suggestions, I would like to add a simple user-
invoked solution. "Source" or ".". Any script invoked in this manner
runs in the current instance of the shell.

IMO, if the user(s) are somewhat competent ("obscure project directory"
leads me to believe this may be the case), this simple solution may be
the most "elegant".