mirror of
https://github.com/sheumann/hush.git
synced 2024-12-21 23:29:34 +00:00
hush: fix "hush -c 'echo $#'" showing -1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
1e811b1231
commit
8a33679694
@ -7080,7 +7080,6 @@ int hush_main(int argc, char **argv)
|
|||||||
/* -c 'script' (no params): prevent empty $0 */
|
/* -c 'script' (no params): prevent empty $0 */
|
||||||
G.global_argv--; /* points to argv[i] of 'script' */
|
G.global_argv--; /* points to argv[i] of 'script' */
|
||||||
G.global_argv[0] = argv[0];
|
G.global_argv[0] = argv[0];
|
||||||
G.global_argc--;
|
|
||||||
} /* else -c 'script' ARG0 [ARG1...]: $0 is ARG0 */
|
} /* else -c 'script' ARG0 [ARG1...]: $0 is ARG0 */
|
||||||
init_sigmasks();
|
init_sigmasks();
|
||||||
parse_and_run_string(optarg);
|
parse_and_run_string(optarg);
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
|
0
|
||||||
|
0
|
||||||
|
1
|
||||||
|
Make sure len parsing doesnt break arg count
|
||||||
0 0
|
0 0
|
||||||
4 4
|
4 4
|
||||||
|
Testing len op
|
||||||
4 3 2 1 0 0
|
4 3 2 1 0 0
|
||||||
0 3 0
|
0 3 0
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
# make sure len parsing doesnt break arg count
|
"$THIS_SH" -c 'echo $#'
|
||||||
|
"$THIS_SH" -c 'echo $#' arg0
|
||||||
|
"$THIS_SH" -c 'echo $#' arg0 arg1
|
||||||
|
|
||||||
|
echo Make sure len parsing doesnt break arg count
|
||||||
set --
|
set --
|
||||||
echo $# ${#}
|
echo $# ${#}
|
||||||
set -- aaaa bbb cc d
|
set -- aaaa bbb cc d
|
||||||
echo $# ${#}
|
echo $# ${#}
|
||||||
|
|
||||||
|
echo Testing len op
|
||||||
echo ${#1} ${#2} ${#3} ${#4} ${#5} ${#6}
|
echo ${#1} ${#2} ${#3} ${#4} ${#5} ${#6}
|
||||||
|
|
||||||
unset e
|
unset e
|
||||||
|
Loading…
Reference in New Issue
Block a user