mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-03 06:41:14 -03:00
Implement an --invert/-v for string match, like grep -v.
Only lines that do not match the pattern are shown.
This commit is contained in:
@@ -1,5 +1,26 @@
|
||||
# tests for string builtin
|
||||
# mostly taken from examples
|
||||
|
||||
string match -r -v "c.*" dog can cat diz; and echo "exit 0"
|
||||
|
||||
string match -q -r -v "c.*" dog can cat diz; and echo "exit 0"
|
||||
|
||||
string match -v "c*" dog can cat diz; and echo "exit 0"
|
||||
|
||||
string match -q -v "c*" dog can cat diz; and echo "exit 0"
|
||||
|
||||
string match -v "d*" dog dan dat diz; or echo "exit 1"
|
||||
|
||||
string match -q -v "d*" dog dan dat diz; or echo "exit 1"
|
||||
|
||||
string match -r -v x y; and echo "exit 0"
|
||||
|
||||
string match -r -v x x; or echo "exit 1"
|
||||
|
||||
string match -q -r -v x y; and echo "exit 0"
|
||||
|
||||
string match -q -r -v x x; or echo "exit 1"
|
||||
|
||||
string length 'hello, world'
|
||||
|
||||
string length -q ""; and echo not zero length
|
||||
@@ -63,3 +84,7 @@ string match -r '[' 'a[sd' 2>/dev/null; or echo "invalid expression error"
|
||||
string invalidarg 2>/dev/null; or echo "invalid argument error"
|
||||
|
||||
string length 2>/dev/null; or echo "missing argument returns 0"
|
||||
|
||||
string match -r -v "[dcantg].*" dog can cat diz; or echo "no regexp invert match"
|
||||
|
||||
string match -v "???" dog can cat diz; or echo "no glob invert match"
|
||||
|
||||
Reference in New Issue
Block a user