[CentOS] Scripting a directory change on CentOS

Tue Jul 31 22:29:21 UTC 2007
Les Mikesell <lesmikesell at gmail.com>

William L. Maltby wrote:
> 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".

I'd go for the symlink in that case.  Perhaps even a directory symlinked 
into everyone's home/Desktop directory that contains symlinks to the 
obscure places.  This has the advantage of providing non-obscure visible 
names, working with GUI tools and is self-documenting with 'ls -l'.

-- 
  Les Mikesell
    lesmikesell at gmail.com