Re: OT: shell prompt tip
> On an unrelated note, I'm *fairly* new to Linux (or UNIX in general), only
> having been using it for about a year. In the DOS command-interpreter 4DOS,
> I could refer to parent directories as . and .. as is the norm in DOS and UNIX.
> But I could also type, say, "cd ....", which would be equivalent of typing
> "cd ..\..\..\". It could be thought of as going up the directory tree, one dot
> per level, the first representing the CWD. Is there any practical way I could
> make bash expand multiple dots like it would wildcards, passing the full
> expanded form onto the program being called, without hacking up the source to
> bash?
>
>
put this into your profile:
cd() {
local p=$1
while :; do
np="${p//.../../..}"
test "$p" == "$np" && break
p="$np"
done
builtin cd "$p"
}
possibly not the simplest way, but it works.
--
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Real programmers don't comment their code.
It was hard to write, it should be hard to understand.
--
Become part of the world's biggest computer cluster -
join http://www.distributed.net/
Reply to: