rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: "Paul D. Swasey" <ps3u+@andrew.cmu.edu>
To: rc@archone.tamu.edu
Subject: interactive cd
Date: Tue, 1 Oct 1991 09:36:03 -0500	[thread overview]
Message-ID: <Mcu8THO00awCE9hXtm@andrew.cmu.edu> (raw)
In-Reply-To: <91Sep30.110621cdt.19044@archone.tamu.edu>

After using Bash then ksh for such a while, I find myself missing the
symbolic link following done by those shells...  So I wrote a version
of cd that maintained it's own version of the working directory and
handled cd .. by hacking that version the cd'ing to the result
(talking about rc functions, not C).

After a little use, I realized I had forgotten about cdpath.  I am now
stuck.   I wanted to give the same interface as builtin cd and was
counting on it to loop through cdpath for me (a hi-level loop here is
*slow*) ... I was using something like dir = `{builtin cd $1}
...thinking dir would be () if $1 was in the current directory or dir
would be the new absolute path of $cwd (the variable holding the
working directory).  Of course, `{ } invokes a non-interactive
subshell and builtin cd doesn't print the directory if cdpath is
used...oops

My question is do you think it's "right" to add a my_chdir() to rc
that deals with ..  `correctly'?  (It would only be a run-time option,
of course).  My original intent was to make a function to use
interactivley ... not touching the correct semantics of cd.  Now that
I've started writing my_chdir, I'd like to know if anything like it
will ever be in the official rc, given that such a "feature" is a
possible source of confusion:

; ENV=() ksh
Switching to new tty driver...
$ cd ; ls
Emacs           OldFiles        docs            lib             src
u		Mailbox         bin             include         man
tmp
$ cd bin; /bin/pwd
/afs/andrew.cmu.edu/usr16/ps3u/.depot/pmax_ul4/bin
$ more ../tmp/*
../tmp/: No such file or directory
$ ls ~/tmp
bash                    forth                   netrek_scoutiness
nt_servers		unix			client
guest_list              nt_clients		to_handle
$


Is anyone interested in the function or (when I finish it -- not
today, I'm tired) the code?

-dave

ps3u+@andrew.cmu.edu
R746PS3U@VB.CC.CMU.EDU


      reply	other threads:[~1991-10-01 14:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-09-30 16:06 say what you mean Byron Rakitzis
1991-10-01 14:36 ` Paul D. Swasey [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Mcu8THO00awCE9hXtm@andrew.cmu.edu \
    --to=ps3u+@andrew.cmu.edu \
    --cc=rc@archone.tamu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).