mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 11:22:52 +08:00
Do import bash history commands containing && or ||
This commit is contained in:
parent
1cfa3fa819
commit
e94b9ccf3e
|
@ -3984,6 +3984,7 @@ void history_tests_t::test_history_formats() {
|
|||
// The results are in the reverse order that they appear in the bash history file.
|
||||
// We don't expect whitespace to be elided (#4908: except for leading/trailing whitespace)
|
||||
const wchar_t *expected[] = {L"sleep 123",
|
||||
L"a && echo valid construct",
|
||||
L"final line",
|
||||
L"echo supsup",
|
||||
L"export XVAR='exported'",
|
||||
|
|
|
@ -1127,10 +1127,6 @@ static bool should_import_bash_history_line(const wcstring &line) {
|
|||
if (line.find(L"((") != std::string::npos) return false;
|
||||
if (line.find(L"))") != std::string::npos) return false;
|
||||
|
||||
// Temporarily skip lines with && and ||
|
||||
if (line.find(L"&&") != std::string::npos) return false;
|
||||
if (line.find(L"||") != std::string::npos) return false;
|
||||
|
||||
// Skip lines that end with a backslash. We do not handle multiline commands from bash history.
|
||||
if (line.back() == L'\\') return false;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ echo hello \
|
|||
another `command
|
||||
and arg` to skip
|
||||
backticks `are not allowed`
|
||||
a && echo invalid construct
|
||||
a && echo valid construct
|
||||
[[ x = y ]] && echo double brackets not allowed
|
||||
(( 1 = 2 )) && echo double parens not allowed
|
||||
posix_cmd_sub $(is not supported)
|
||||
|
|
Loading…
Reference in New Issue
Block a user