LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 11-11-2012, 01:29 PM   #1
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,970

Rep: Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848
CDPATH not working


Hello,

I've read about CDPATH in this http://docs.slackware.com/howtos:sof...igation#cdpath Howto at SlackDocs. But it doesn't work here.

I've read the manpage for bash and think it should work like described in the Howto.

By default $CDPATH is not set, is this correct?

Now I have
Code:
CDPATH=$CDPATH:/tmp/
put in my .bashrc.
Code:
markus@samsung:~$ echo $CDPATH
:/tmp/
After sourcing .bashrc I thought that I could cd into directories in /tmp/ with only the name of the directory, but this doesn't work. I have also tried it with directories in my ~/ directory, this doesn't work as well.

Any Ideas?

Markus
 
Old 11-11-2012, 01:49 PM   #2
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,564
Blog Entries: 1

Rep: Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024
Hi Marcus,

I think that the description entry in the wiki is misleading (although the examples are correct). My apologies. I'm going to clarify it right now.

You do not include the directories that you want to cd into. You include the parent directory.

From bash:
Quote:
This is a colon-separated list of directories in which the shell looks for destination directories specified by the cd command.
HTH
 
Old 11-11-2012, 01:53 PM   #3
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,970

Original Poster
Rep: Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848
Quote:
Originally Posted by sycamorex View Post
Hi Marcus,

I think that the description entry in the wiki is misleading (although the examples are correct). My apologies. I'm going to clarify it right now.

You do not include the directories that you want to cd into. You include the parent directory.

From bash:


HTH
Thanks sycamorex for the quick reply,

I did this, I have for example several directories in /tmp/ named /tmp/build-ocaml, /tmp/build-trayer and so on (used for Slackbuilds). When I type
Code:
build-o[TAB]
the line is not expanded.

Markus
 
Old 11-11-2012, 02:02 PM   #4
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,564
Blog Entries: 1

Rep: Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024
Weird. It works for me on 2 machines with stock Slackware 14 bash:
Code:
.bashrc
CDPATH=$CDPATH:/tmp/
Code:
echo $CDPATH
:/tmp/
Code:
ls /tmp
abc/  bcd/  cde/  def/  i3-sycamorex.cFpmeG/  plugtmp/

cd a[TAB] expands to abc.

Code:
cd abc/
/tmp/abc
 
Old 11-11-2012, 02:06 PM   #5
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,970

Original Poster
Rep: Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848
Is it possible that it has something to do with bash-completion? I don't have bash-completion installed.....

But otherwise referring to the manpage for bash, CDPATH should work like you described it.

It's really weird.

Markus
 
1 members found this post helpful.
Old 11-11-2012, 02:23 PM   #6
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,564
Blog Entries: 1

Rep: Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024Reputation: 1024
I think you've nailed it. It looks like the CDPATH variable itself does not provide TAB completion. It will correctly cd into a said directory as long as you remember its exact name, eg:

Code:
cd build-trayer[Enter]
but to get the TAB completion you do need to install bash-completion.
 
1 members found this post helpful.
Old 11-11-2012, 02:24 PM   #7
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,970

Original Poster
Rep: Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848
Yup, that works.

Thanks for the clarification.

Markus
 
  


Reply

Tags
bash


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Wifi not working in Eee PPC 1000HE (Debian Squeeze), but ethernet is working someshpr Linux - Laptop and Netbook 8 10-10-2011 03:59 PM
Bash printing pwd after cd now that I set CDPATH TiredOfThis Linux - Software 5 12-21-2009 02:15 PM
media problem with .avi --- audio only in vlc working rest amarock ,etc. not working fedex Linux - Newbie 1 12-22-2007 08:06 AM
SED - minor changes work - Larger doesn't (working and non working code included) Nimoy Programming 17 09-22-2007 04:34 PM
acpi nearly working IBM thinkpad R40e 2684HVG no Fn key working, throttling OK Emmanuel_uk Linux - Laptop and Netbook 2 05-31-2006 01:41 AM


All times are GMT -5. The time now is 12:48 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration