www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/26/08:27:50

Newsgroups: comp.os.msdos.djgpp
From: design AT netcom DOT com (Chris Waters)
Subject: Re: Changing directories with Bash?
Message-ID: <designE1H22H.3J6@netcom.com>
Organization: Design and Delivery
References: <Pine DOT SGI DOT 3 DOT 95 DOT 961125210027 DOT 9505A-100000 AT xsc02 DOT gl DOT umbc DOT edu>
Date: Tue, 26 Nov 1996 09:51:52 GMT
Lines: 53
Sender: design AT netcom8 DOT netcom DOT com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <Pine DOT SGI DOT 3 DOT 95 DOT 961125210027 DOT 9505A-100000 AT xsc02 DOT gl DOT umbc DOT edu>,
Patrick  <pjenki1 AT gl DOT umbc DOT edu> wrote:
>Suppose I want to change dirs to \Program Files.  Unix (afaik) doesn't
>allow spaces.  Is there any way around this?  I tried:
>1. putting the " the microsoft has you put

Using the Unix version of bash:

  ~$ md "has space"
  ~$ cd "has space"
  ~/has space$ cd ..
  ~$ rmdir "has space"
  ~$

If this doesn't work in the djgpp version, there's a problem, and I'd
report it to the person who ported bash.  (I can't try it because I
don't have a version of DOS that supports long filenames.)

>2. "dir" and 'd' print out backslashes after every word in a long filename
>(w/ spaces).  On a guess, I tried changing dirs with one of the seperated
>(by a backslash) words.  THis works about 50% of the time.

What's "dir"?  What's 'd'?  Normally, "dir" is a COMMAND.COM builtin,
and doesn't work under Unix-like shells for DOS.  Are these some sort of
builtins added to the DOS version of bash, or scripts you wrote, or
something entirely different?

The backslash is an escape (much like in C strings).  Again, this works
under Unix:

  ~$ md has\ space
  ~$ cd has\ space
  ~/has space$ cd ..
  ~$ cd "has space"
  ~/has space$ cd ..
  ~$

It should work 100% of the time, as should the double quotes.

BTW, is it possible that your problem is as simple as using the wrong
slashes?  Try using forward slashes as directory separators, i.e.:

  bash$ cd "/Program Files"

or
  bash$ cd /Program\ Files

rather than:

  bash$ cd "\Program Files"

The first two will look for the directory in the root, the last in the
current directory.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019