shell_word_split Parse words from a string, emulating word-splitting as the shell does. std::string in("echo hello world"); std::vector<std::string> words; sws::shell_word_split(in.begin(), in.end(), std::back_inserter(words)); for( auto const w : words ) std::cout << '"' << w << "\" "; // "echo" "hello" "world" std::cout << words.size() << '\n'; // 3 in = "echo \ \ 5"; words.clear(); sws::shell_word_split(in.begin(), in.end(), std::back_inserter(words)); for( auto const w : words ) std::cout << '"' << w << "\" "; // "echo" " " " 5" std::cout << words.size() << '\n'; // 3 in = "\\"hello there\\""; words.clear(); sws::shell_word_split(in.begin(), in.end(), std::back_inserter(words)); for( auto const w : words ) std::cout << '"' << w << "\" "; // "hello there" std::cout << words.size() << '\n'; // 1 This is useful for me as a tool for testing commandline input in other projects.