Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to setup alias/function to call Total Commander from bash (MINGW) on windows. So far all my attempts failed, the closes

function tc() {
  dir="$1"
  if [ "$dir" == "" ]; then
    dir="."
  fi
  /c/TotalCmd/totalcmd.exe /O /L="`cygpath -wa $dir`" /R="`cygpath -wa .`" &

}

This solution has one drawback: TC is opened with given directories, but paths have additional / in them. This makes TC to go to root when I am trying to go one directory up.

enter image description here

Do you know how to setup this alias to work correctly? Thank you!

share|improve this question

2 Answers 2

up vote 1 down vote accepted

You have to quote the $dir parameter, otherwise you may be giving more than two strings as arguments to cygpath (1st -wa, 2nd /path/). This will be a problem only when the $dir parameter holds a directory whose path contains spaces.

I.E.

cygpath -wa "~/x/hello world"

is not the same as

cygpath -wa ~/x/hello world

This should work for you (as it did for me):

jaroslav@wraptor ~
$ function winPath { cygpath.exe  -wa -- "$1"; }
$ FreeCommander.exe C: "$(winPath /cygdrive/m/muzica/_christian_liturgy/\
    Athonite\ Fathers\ of\ St.\ Anthony\'s\ Greek\ Orthodox\ Monastery\ -\ \
    Vigil\ of\ St.\ Anthony/)"
share|improve this answer
    
Thank you, but it did not fixed it :-( I have used your function and /c/TotalCmd/totalcmd.exe /O /L="$(winPath $dir)" & but situation is still the same. I am starting to believe that there is something rotten in TC... –  jasir Feb 18 '13 at 22:28

So solution that works, thanks Jaroslav!

function tc() {
  dir="$1"
  if [ "$dir" == "" ]; then
    dir="."
  fi
  /c/totalcmd/totalcmd.exe /O L="`winPath $dir`"
}

function winPath { cygpath.exe  -wa -- "$1"; }
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.