esh: Support for $$
This commit is contained in:
parent
c76722a4c4
commit
90b102754f
@ -635,6 +635,7 @@ int variable_char(uint8_t c) {
|
||||
if (c >= '0' && c <= '9') return 1;
|
||||
if (c == '_') return 1;
|
||||
if (c == '?') return 1;
|
||||
if (c == '$') return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -811,6 +812,9 @@ int shell_exec(char * buffer, size_t size, FILE * file, char ** out_buffer) {
|
||||
if (!strcmp(var, "?")) {
|
||||
sprintf(tmp,"%d",last_ret);
|
||||
c = tmp;
|
||||
} else if (!strcmp(var, "$")) {
|
||||
sprintf(tmp,"%d",getpid());
|
||||
c = tmp;
|
||||
} else if (is_number(var)) {
|
||||
int a = atoi(var);
|
||||
if (a >= 0 && a < shell_argc) {
|
||||
|
Loading…
Reference in New Issue
Block a user