1

Can someone explain me what is happening here? What does the output means?

:$ echo $-3
himBH3
:$ echo $-2
himBH2
:$ echo $-1
himBH1

Thanks.

jotik
  • 17,044
  • 13
  • 58
  • 123
Lee Xu
  • 35
  • 4

1 Answers1

5

$- is a variable that contains the currently active shell options.

-

(A hyphen.) Expands to the current option flags as specified upon invocation, by the set builtin command, or those set by the shell itself (such as the -i option).

Your command is evaluating to the value of - then a number.

Etan Reisner
  • 77,877
  • 8
  • 106
  • 148