# my_shell **Repository Path**: wswh2oh2o/my_shell ## Basic Information - **Project Name**: my_shell - **Description**: 参考nr_micro_shell 自己实现的一个简易的shell, - **Primary Language**: C - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-02-25 - **Last Updated**: 2021-02-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # my_shell 参考nr_micro_shell 自己实现的一个简易的shell,通过数组方式实现接受动态参数 发送命令 cmd_test 10 90 ----------------------argv数据排布---------------------- |10|19|22|----...-----|c|m|d|_|t|e|s|t|0x0|1|0|0x0|9|0|0x00|0x00|0x00|0x00|0x00|0x00| |-----10byte------|---|-P0------------|----|-P1-|--|-P2-|----------| 参数1 = (argv[argv[0]]) 参数2 = (argv[argv[1]]) 参数3 = (argv[argv[2]]) # 添加命令 在 bsp_shell_cmd.c 文件中添加命令 ## 实例 /*命令函数*/ void shell_cmd_test(char argc, char *argv) { unsigned int i = 0; if (argc > 1) { for (i = 0; i < argc; i++) { LOG_INFO("paras %d: %s\r\n", i, &(argv[argv[i]])); } } } /*添加命令*/ const static_shell_st static_shell[] = { /*命令 命令实现 命令描述符*/ {"cmd_test",shell_cmd_test,shell_test_description}, }; # 使用 定周期调用 int shell_scan_parameter(uint8_t * buff,uint8_t len) buff:接受到的命令缓存 len:命令缓存长度