aboutsummaryrefslogtreecommitdiff
path: root/shell/hush.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/hush.c')
-rw-r--r--shell/hush.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 20b092398..f9dad074f 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -5559,8 +5559,10 @@ static NOINLINE const char *expand_one_var(char **to_be_freed_pp, char *arg, cha
5559 first_char = arg[0] = arg0 & 0x7f; 5559 first_char = arg[0] = arg0 & 0x7f;
5560 exp_op = 0; 5560 exp_op = 0;
5561 5561
5562 if (first_char == '#' /* ${#... */ 5562 if (first_char == '#' && arg[1] /* ${#... but not ${#} */
5563 && arg[1] && !exp_saveptr /* not ${#} and not ${#<op_char>...} */ 5563 && (!exp_saveptr /* and (not ${#<op_char>...} */
5564 || (arg[1] == '?' && arg[2] == '\0') /* or ${#?} - "len of $?") */
5565 )
5564 ) { 5566 ) {
5565 /* It must be length operator: ${#var} */ 5567 /* It must be length operator: ${#var} */
5566 var++; 5568 var++;
@@ -5797,7 +5799,11 @@ static NOINLINE const char *expand_one_var(char **to_be_freed_pp, char *arg, cha
5797 /* mimic bash message */ 5799 /* mimic bash message */
5798 die_if_script("%s: %s", 5800 die_if_script("%s: %s",
5799 var, 5801 var,
5800 exp_word[0] ? exp_word : "parameter null or not set" 5802 exp_word[0]
5803 ? exp_word
5804 : "parameter null or not set"
5805 /* ash has more specific messages, a-la: */
5806 /*: (exp_save == ':' ? "parameter null or not set" : "parameter not set")*/
5801 ); 5807 );
5802//TODO: how interactive bash aborts expansion mid-command? 5808//TODO: how interactive bash aborts expansion mid-command?
5803 } else { 5809 } else {