Conversation
| || (text.find('~').unwrap_or(0) == text.len() - 1) | ||
| { | ||
| let temp = text.clone().replace( | ||
| '~', |
There was a problem hiding this comment.
Can you add this as a test case? I think it will fail: echo ~/test/~/test (should only expand ~/)
dsherret
left a comment
There was a problem hiding this comment.
Thanks! Let's shift this to happen when executing and not when parsing.
| text.push_str(temp.as_str()); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
I don't think we should do this while parsing, but instead during execution. The home directory in the shell might change while running. For example, the following test case should pass:
$ export HOME=test ; echo ~/test/~/test
test/test/~/test|
@dsherret |
@dsherret |
|
Sorry, I wasn't sure what the solution was here until I went to go work on it myself. Basically, we needed to parse the tildes and then expand them during execution. See #146 |
This PR suggests possible solution for #26676
Changes