Re: [Fish-users] string functions on strings that start with a dash

2017-09-25 Thread Glenn Jackman
`string match` is a good choice here as well: if string match -q -- '-*' $test; echo yes; end On Sun, Sep 24, 2017 at 9:35 PM, Alex Boisvert wrote: > Use "--" (double-dash), which is used to indicate the end of command > options, after which only positional parameters are accepted. > > This

Re: [Fish-users] string functions on strings that start with a dash

2017-09-24 Thread Alex Boisvert
Use "--" (double-dash), which is used to indicate the end of command options, after which only positional parameters are accepted. This works: set firstChar (string sub -s1 -l1 -- "$text") On Sun, Sep 24, 2017 at 5:47 PM, Mark Volkmann wrote: > > Suppose I have this: > set text '-foo' > > How

[Fish-users] string functions on strings that start with a dash

2017-09-24 Thread Mark Volkmann
Suppose I have this: set text '-foo' How can I determine whether the first character of the string in $text is a dash? I tried this: set firstChar (string sub -s1 -l1 "$text") But that doesn't work because "string sub" thinks I'm trying to specify another switch since $text starts with a dash, an