Do import bash history commands containing && or ||

This commit is contained in:
Johannes Altmanninger 2019-11-07 23:08:31 +01:00
parent 1cfa3fa819
commit e94b9ccf3e
3 changed files with 2 additions and 5 deletions

View File

@ -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'",

View File

@ -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;

View File

@ -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)