Bash puzzle: Spaces, environment variables and tab completion

2002-12-03 Thread James Shaw
Hi everyone, I have been using cygwin for several months, and there is something that I haven't been able to figure out how to do: effectively use spaces in bash environment varibles. I realize this is basically a bash question and isn't cygwin specific, but I'm sure more cygwin users have to dea

Re: Bash puzzle: Spaces, environment variables and tab completion

2002-12-03 Thread Randall R Schulz
James, You're swimming upstream. Don't do that. Use the system in accordance with its design. Parsing command lines based on white-space separators fundamentally entails the need for escaping or quoting when those separator characters are to be included in the arguments and not used to separat

RE: Bash puzzle: Spaces, environment variables and tab completion

2002-12-03 Thread Gary R. Van Sickle
[snip $PF is a path with spaces] > So, I ask the list: > Can you define $PF so that cd $PF; > ls $PF/Games; and ls $PF/G all work??? Yep: use single-quotes ('), not double ("). And ask not why; there are none alive who understand the seemingly random shell quoting rules. Note al

RE: Bash puzzle: Spaces, environment variables and tab completion

2002-12-03 Thread Gary R. Van Sickle
> James, > > You're swimming upstream. Don't do that. Use the system in accordance with > its design. > Don't listen to him Jim! You pound anything long enough, it'll give! > Parsing command lines based on white-space separators fundamentally entails > the need for escaping or quoting when those

Re: Bash puzzle: Spaces, environment variables and tab completion

2002-12-04 Thread Ehud Karni
> > What I want to do is define an environment > variable so I can easily cd or ls. E.g. > % PF="/cygdrive/c/Program Files" > % cd $PF > % ls $PF/Games > % ls $PF/G > > The above is close, I can > % cd "$PF"; ls "$PF"/Games; and even > ls "$PF"/G however, the quotes are clunky. That's the bash

Re: Bash puzzle: Spaces, environment variables and tab completion

2002-12-04 Thread Michael Schaap
On 4-12-2002 7:09, James Shaw wrote: (...) What I want to do is define an environment variable so I can easily cd or ls. E.g. % PF="/cygdrive/c/Program Files" % cd $PF % ls $PF/Games % ls $PF/G (...) So, I ask the list: Can you define $PF so that cd $PF; ls $PF/Games; and ls $

RE: Bash puzzle: Spaces, environment variables and tab completion

2002-12-04 Thread Randall R Schulz
At 23:23 2002-12-03, Gary R. Van Sickle wrote: > James, > > You're swimming upstream. Don't do that. Use the system in accordance with > its design. > Don't listen to him Jim! You pound anything long enough, it'll give! Ordinarily, I agree, but on this point, you'd have to re-write the shell's

Re: Bash puzzle: Spaces, environment variables and tab completion

2002-12-04 Thread Igor Pechtchanski
On Wed, 4 Dec 2002, Michael Schaap wrote: > On 4-12-2002 7:09, James Shaw wrote: > (...) > > What I want to do is define an environment > > variable so I can easily cd or ls. E.g. > > % PF="/cygdrive/c/Program Files" > > % cd $PF > > % ls $PF/Games > > % ls $PF/G > > > (...) > > > > So, I ask the

Re: Bash puzzle: Spaces, environment variables and tab completion

2002-12-04 Thread Michael Schaap
On 4-12-2002 17:17, Igor Pechtchanski wrote: On Wed, 4 Dec 2002, Michael Schaap wrote: On 4-12-2002 7:09, James Shaw wrote: (...) What I want to do is define an environment variable so I can easily cd or ls. E.g. % PF="/cygdrive/c/Program Files" % cd $PF % ls $PF/Games % ls $PF/G (...) S

Re: Bash puzzle: Spaces, environment variables and tab completion

2002-12-04 Thread Randall R Schulz
Igor, At 08:17 2002-12-04, you wrote: On Wed, 4 Dec 2002, Michael Schaap wrote: > On 4-12-2002 7:09, James Shaw wrote: > (...) > > What I want to do is define an environment > > variable so I can easily cd or ls. E.g. > > % PF="/cygdrive/c/Program Files" > > % cd $PF > > % ls $PF/Games > > % ls

Re: Bash puzzle: Spaces, environment variables and tab completion

2002-12-04 Thread James Shaw
Hi all, Thanks to everyone for the advice. The first posts of advice were that it wasn't possible to do within the bash quoting mechanism: "You're swimming upstream. Don't do that. Use the system in accordance with its design." I agree that I felt like I was swimming upstream. Hence my post. I

Re: Bash puzzle: Spaces, environment variables and tab completion

2002-12-04 Thread Randall R Schulz
James, At 22:01 2002-12-04, James Shaw wrote: Hi all, Thanks to everyone for the advice. The first posts of advice were that it wasn't possible to do within the bash quoting mechanism: "You're swimming upstream. Don't do that. Use the system in accordance with its design." I agree that I fe

RE: Bash puzzle: Spaces, environment variables and tab completion

2002-12-04 Thread Gary R. Van Sickle
> Although I appreciate Gary's encouragement, going > around bash instead of struggling with it, does > seem the better solution. Well now, I never said you couldn't cheat a *little* ;-). > There were several > variations on the same theme on this bypass > solution. Thanks to Ehud, Michael and

Re: Bash puzzle: Spaces, environment variables and tab completion

2002-12-05 Thread Lassi A. Tuura
You might want to try with zsh, it's more flexible and convenient to use than bash. I haven't used it on Windows, but here's a linux example: $ mkdir -p '/tmp/foo/a bar' $ F='/tmp/foo/a bar' $ ls -ld $F drwxr-xr-x2 lat zh 4096 Dec 5 11:26 /tmp/foo/a bar $ touch $F/xyz

Re: Bash puzzle: Spaces, environment variables and tab completion

2002-12-05 Thread Ehud Karni
On Wed, 4 Dec 2002 22:01:04 -0800 (PST), James Shaw <[EMAIL PROTECTED]> wrote: > > One minus with this 'cheat' is that I don't get > the 'real' name of the path. E.g. If I cd ~/pf, > bash (correctly) thinks that I'm in /home/jhs/pf, > but it would be nice to use the long name. If it > was a hard

Re: Bash puzzle: Spaces, environment variables and tab completion

2002-12-05 Thread James Shaw
Hi everyone, > PF=$(cygpath -u $(cygpath -d '/cygdrive/c/Program Files')) And we have a winner! Gary wins the December Bash Hacking award. (Well, IMHO) Clunky, yes with the DOS 8.3 names, but it is the closest to solving the puzzle (without cheating). > Learn about "cygstart" and you won't ha