I have a bash command that requires a string value after "-v". When this string value has a leading "-", bash tries to interpret it as a new option of the bash command rather than the value I'm trying to give for -v. Is there a way I can escape this leading hyphen? I tried
-v -- -myValue
opts = Trollop::options do
opt :method, "Encrypt or Decrypt", :short => "m", :type => :string, :default => "decrypt"
opt :value, "Value to Decrypt or Encrypt", :short => "v", :type => :string, :default => ""
There's two conventional ways to specify arguments, but these are not enforced at the shell level, they're just tradition:
-v xxxx --value=xxxx
Now it's sometimes possible to do:
If you have a value with a dash and it's not being interpreted correctly, do this: