Any Bash features you'd like to see?
Chris F.A. Johnson
cfaj-uVmiyxGBW52XDw4h08c5KA at public.gmane.org
Sat May 14 15:39:28 UTC 2005
On Sat, 14 May 2005, Scott Allen wrote:
> On Fri May 13,2005 09:33:47 AM Chris F.A. Johnson wrote:
>> You already have random access with popd:
>>
>> popd: popd [+N | -N] [-n]
>> Removes entries from the directory stack. With no arguments,
>> removes the top directory from the stack, and cd's to the new
>> top directory.
>
> So for random access directory changes I have to:
>
> - Always use pushd (or an alias) to change directories.
A function is better.
> - Do a dirs command to list my previous directories.
>
> - Count left or right from the dirs listing to determine the value of N that
> I need to use.
>
> - Enter a popd command with the N parameter to change to the desired
> directory.
>
> This seems pretty cumbersome. In most cases, using cd with tab completion
> would probably be faster. It's not like the quick "select from a pop up
> window involked by a single key press" method that I'm used to with the 4OS2
> shell.
cd() { pushd "${@:-$HOME}"; }
cdx() { popd "$@"; }
_cdx() ## Tab completion function for cdx
{
COMPREPLY=( `dirs` )
}
complete -F _cdx cdx
--
Chris F.A. Johnson <http://cfaj.freeshell.org>
==================================================================
Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress
<http://www.torfree.net/~chris/books/ssr.html>
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list