0

How do I set a variable in Bash Zsh with a single dash (-)?

None of these work:

x=-
x=\-
x='-' 

EDIT: this seems to work fine in Bash, I was testing this with echo in Zsh which doesn't work.

AdminBee
  • 22,803
Subbeh
  • 420

1 Answers1

0

The problem was with echo. The variable is assigned correctly but had to be used with echo - $x instead.

Subbeh
  • 420