Can SHELL commands include uppercase ?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Can SHELL commands include uppercase ?

跳至解决方案
1,238 次查看
walter_gallegos
Contributor I

Apparently names including uppercase as "WriteSpi" are not recognized as a command but "writespi" yes.

Can SHELL commands include uppercase ?

Capture 1:

shell> help

Available commands:

...

   version

   config

   reboot

   WriteSpi

shell> help WriteSpi

Write SPI Ports

Usage: WriteSpi

shell> WriteSpi

Invalid command.  Type 'help' for a list of commands.

shell>

Capture 2:

shell> help

Available commands:

...

   version

   config

   reboot

   writespi

shell> help writespi

Write SPI Ports

Usage: writespi

shell> writespi

CmdsWriteSPI 

shell>

标记 (2)
0 项奖励
回复
1 解答
1,028 次查看
matthewkendall
Contributor V

The shell command interpreter converts the command name to lower case before searching the table of registered commands. You can see this in shell.c line 109. Hence, command names must be in lower case. The reason that the help command works correctly with mixed case names is that this code does not convert the command name to lower case before searching the command table. You can see this in sh_help.c line 74.

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,029 次查看
matthewkendall
Contributor V

The shell command interpreter converts the command name to lower case before searching the table of registered commands. You can see this in shell.c line 109. Hence, command names must be in lower case. The reason that the help command works correctly with mixed case names is that this code does not convert the command name to lower case before searching the command table. You can see this in sh_help.c line 74.

0 项奖励
回复
1,028 次查看
walter_gallegos
Contributor I

Matthew,

Thank you for answering, apparently we have different MQX versions, not at shell.c line 109 but 113

_io_strtolower(shell_ptr->ARGV[0]);

Do you know the reason of this inconsistencies with the upper/lower case processing ?

0 项奖励
回复