Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] cd fails to work
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
sotha_sil
Tux's lil' helper
Tux's lil' helper


Joined: 08 Mar 2005
Posts: 84

PostPosted: Thu Dec 08, 2005 2:29 pm    Post subject: [solved] cd fails to work Reply with quote

cd fails to work on certain directories. I have isolated the problem to this simple series of repeatable steps:
Code:
$ cd ~
$ mkdir "test 1" && mkdir "test 1/test 2"
$ cd "test 1/test 2"
basename: too many arguments
Try `basename --help' for more information.
$ pwd
/home/bob/test 1/test 2
basename: too many arguments
Try `basename --help' for more information.
$ ls
basename: too many arguments
Try `basename --help' for more information.
$ basename --help
Usage: basename NAME [SUFFIX]
  or:  basename OPTION
Print NAME with any leading directory components removed.
If specified, also remove a trailing SUFFIX.

      --help     display this help and exit
      --version  output version information and exit

Report bugs to <bug-coreutils@gnu.org>.
$


Last edited by sotha_sil on Fri Dec 09, 2005 4:32 am; edited 1 time in total
Back to top
View user's profile Send private message
plasmagunman
l33t
l33t


Joined: 07 Jun 2002
Posts: 604
Location: berlin

PostPosted: Thu Dec 08, 2005 3:03 pm    Post subject: Reply with quote

do you know why it's always performing "basename" after each step? that's not normal. have you set anythink like PS1 or xterm-title to show the current working directory? perhaps something wants to know the name of the pwd after each command and it's doing something like
Code:
basename `pwd`
instead of
Code:
basename "`pwd`"

_________________
please, feel free to correct my english. - por favor, corrige mi español.
Back to top
View user's profile Send private message
nixnut
Bodhisattva
Bodhisattva


Joined: 09 Apr 2004
Posts: 10974
Location: the dutch mountains

PostPosted: Thu Dec 08, 2005 6:25 pm    Post subject: Reply with quote

cd test\ 1/
use a "\" to escape (as it's called) the space.
_________________
Please add [solved] to the initial post's subject line if you feel your problem is resolved. Help answer the unanswered

talk is cheap. supply exceeds demand
Back to top
View user's profile Send private message
plasmagunman
l33t
l33t


Joined: 07 Jun 2002
Posts: 604
Location: berlin

PostPosted: Thu Dec 08, 2005 11:17 pm    Post subject: Reply with quote

nixnut wrote:
cd test\ 1/
use a "\" to escape (as it's called) the space.

if you escape the space you have to omit the double quotes. and shouldn't change a think:
Code:
cd test\ 1
and
Code:
cd "test 1"
should be the same.
_________________
please, feel free to correct my english. - por favor, corrige mi español.
Back to top
View user's profile Send private message
sotha_sil
Tux's lil' helper
Tux's lil' helper


Joined: 08 Mar 2005
Posts: 84

PostPosted: Fri Dec 09, 2005 4:32 am    Post subject: Reply with quote

plasmagunman wrote:
do you know why it's always performing "basename" after each step? that's not normal. have you set anythink like PS1 or xterm-title to show the current working directory? perhaps something wants to know the name of the pwd after each command and it's doing something like
Code:
basename `pwd`
instead of
Code:
basename "`pwd`"

Wow. You are a genius. My .bashrc file displays the current directory in the prompt via this line:
Code:
PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]$(basename $PWD) \$ \[\033[00m\]'

Commenting out that line and replacing it with this next bit seems to have fixed the problem:
Code:
PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]$(basename "$PWD") \$ \[\033[00m\]'


btw: I tested and found out that
Code:
"test 1"
is the same as
Code:
test\ 1
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum