Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Alias for internal command

Jun
98
0
[I'm trying to use MSYS together with TCC]

I want to use an external command (exe file) instead of internal.
For example: dir.exe

I expect to get something like that:
DIR - executes specific dir.exe
*DIR - executes TCC' DIR command.

So let's alias:
alias dir="z:\P Apps\PortableApps\CommonFiles\MSYS\App\msys\bin\dir.exe"

"*dir" works fine
In most cases "dir" works fine, too, but

DIR. (DIR and a dot without space) still calls internal command
DIR.mydata" (without space) executes internal "DIR .mydata"

It can be partially fixed:
alias dir.*="z:\P Apps\PortableApps\CommonFiles\MSYS\App\msys\bin\dir.exe"
In that case
dir. invokes external dir.exe (I'm not sure if a dot is passed as %1), but dir.mydata still invokes internal dir command.

So
alias dir.*="z:\P Apps\PortableApps\CommonFiles\MSYS\App\msys\bin\dir.exe"
works exactly as
alias dir.="z:\P Apps\PortableApps\CommonFiles\MSYS\App\msys\bin\dir.exe" (without asterisk)
 
It seems like there's nothing to fix. The name of an EXE followed by a dot with no space never works the as you wish.
Code:
c:\windows\system32> ftp.
TCC: Unknown command "ftp."

c:\windows\system32> netstat.
TCC: Unknown command "netstat."

g:\tc16> tcc.
TCC: Unknown command "tcc."
 
Ech. There is some misunderstanding.

Lets make the same aliases for commands DIR and XIR
alias dir="z:\P Apps\PortableApps\CommonFiles\MSYS\App\msys\bin\dir.exe"
alias xir="z:\P Apps\PortableApps\CommonFiles\MSYS\App\msys\bin\dir.exe"
alias dir.*="z:\P Apps\PortableApps\CommonFiles\MSYS\App\msys\bin\dir.exe"
alias xir.*="z:\P Apps\PortableApps\CommonFiles\MSYS\App\msys\bin\dir.exe"

Let.s make directory (with leading dot)
mkdir .test

and:
dir.test: executes (internal) "dir .test"
xir.test: Unknown command "xir.test"
 
Lets make directory (with leading dot)
mkdir .test

and:
dir.test: executes (internal) "dir .test"
xir.test: Unknown command "xir.test"

So, put a space between the command and its argument, just as you did with MKDIR. (If all else fails, try using correct syntax.)
 
So, put a space between the command and its argument, just as you did with MKDIR. (If all else fails, try using correct syntax.)

Hihi :)

Ok. I see the difference (why dir.test works and xir.test doesn't).
But - is it possible to create an alias for all dir.* commands?
 
Ech. There is some misunderstanding.

Lets make the same aliases for commands DIR and XIR
alias dir="z:\P Apps\PortableApps\CommonFiles\MSYS\App\msys\bin\dir.exe"
alias xir="z:\P Apps\PortableApps\CommonFiles\MSYS\App\msys\bin\dir.exe"
alias dir.*="z:\P Apps\PortableApps\CommonFiles\MSYS\App\msys\bin\dir.exe"
alias xir.*="z:\P Apps\PortableApps\CommonFiles\MSYS\App\msys\bin\dir.exe"

Let.s make directory (with leading dot)
mkdir .test

and:
dir.test: executes (internal) "dir .test"
xir.test: Unknown command "xir.test"
That all seems right to me. The first token on a command line is supposed to be followed by a space. Rex has (reluctantly) allowed some perversions in the case of internal commands to pacify a few who insist on not using correct syntax.
 
The first token on a command line is supposed to be followed by a space. Rex has (reluctantly) allowed some perversions in the case of internal commands to pacify a few who insist on not using correct syntax.

In fairness, I should confess to using ECHO. myself. Old dogs, etc.
 

Similar threads

Back
Top