Better messages for ignored backslashes like 'echo foo\n'
This commit is contained in:
parent
2f21ced552
commit
ce0b313b93
|
@ -691,8 +691,15 @@ readNormalEscaped = called "escaped char" $ do
|
||||||
<|>
|
<|>
|
||||||
do
|
do
|
||||||
next <- anyChar
|
next <- anyChar
|
||||||
parseNoteAt pos WarningC $ "Did you mean \"$(printf \"\\" ++ [next] ++ "\")\"? The shell just ignores the \\ here."
|
case escapedChar next of
|
||||||
|
Just name -> parseNoteAt pos WarningC $ "\\" ++ [next] ++ " is just literal '" ++ [next] ++ "' here. For " ++ name ++ ", use \"$(printf \"\\" ++ [next] ++ "\")\"."
|
||||||
|
Nothing -> parseNoteAt pos InfoC $ "This \\" ++ [next] ++ " will be a regular '" ++ [next] ++ "' in this context."
|
||||||
return [next]
|
return [next]
|
||||||
|
where
|
||||||
|
escapedChar 'n' = Just "line feed"
|
||||||
|
escapedChar 't' = Just "tab"
|
||||||
|
escapedChar 'r' = Just "carriage return"
|
||||||
|
escapedChar _ = Nothing
|
||||||
|
|
||||||
|
|
||||||
prop_readExtglob1 = isOk readExtglob "!(*.mp3)"
|
prop_readExtglob1 = isOk readExtglob "!(*.mp3)"
|
||||||
|
|
Loading…
Reference in New Issue