This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: BASH :: commenting-out of dirs in aliases


I don't believe this is a bug.  It is the way it works, alas.  In
setting the alias in the .profile, the lines are processed two times,
once when the shell defines the alias and then again when the alias is
run.  This would also be true if you were to define the alias directly
at the command line.  In the second example, the line is processed once.

Look at it this way.  The alias command results in an alias that has a
definition that looks like your second line.  Then, when you run the
alias, the actual command line argument seen by notepad has single
backslashes in it, just as it does for the command line version.

By the way, there is a command, cygpath, that you can use to convert
paths between the two formats.  Type cygpath by itself and you will get
a usage message explaining its use.  There is no man page, at least on
my system, which is the CD version 1.0 of Cygwin.

Also, if you use double quotes, you won't have to put all the extra
backslashes in, which can be confusing.  You could try the following for
the alias definition:

  alias configit="notepad \"$(cygpath -w /home/.profile)\""

You can check the results of the the alias by typing:

  alias configit

which will print out the result of the alias definition.  When I did
this (I used the name cfit for short), I got:

  $ alias cfit
  alias cfit='notepad "c:\Cygwin\home\.profile"'

And the double quotes around the Windows path will protect the enclosed
backslashes.

Cheers,

Bob

Sean Champ wrote:
> 
> as salaem 'alekum.
> 
> may the peace of Allah be upon you.
> 
> -- -- --
> 
> I wish I had the ability to fix this myself, currently, and insha' Allah I
> may be able to soon enough ;)
> 
> I was trying to alias the command
>   configit
> so that it would open up
>    /home/.profile
> for editing
> 
> this is what is required, if it is set as an alias in .profile:
> alias configit="notepad \\\\usr\\\\unix\\\\home\\\\.profile"
> 
> or, I can accomplish the same from the command line by the
> following:
> 
> notepad \\usr\\unix\\home\\.profile
> 
> ...with only two \ each ;)
> 
> and perhaps it is really no problem, but I thought it might be worth a note,
> anyway.
> 
> ...also, has the cygwin team tried using bugzilla or sourceforge, to handle
> such notes as this?
> 
>   (eg, both have a prioritization system for bug-reports, and this seems to
> be a low-priority thing, here.
> 
> also, either of the two could be a better way than this mailing-list, for
> indexing bugs and solutions/patches/workarounds )
> 
> baraka Allah feek(i).
> 
> may the blessings of Allah be upon you.
> 
> --Sean Champ
> 
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe@sourceware.cygnus.com

-- 
Bob McGowan
Staff Software Quality Engineer
VERITAS Software
rmcgowan@veritas.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]