Here's an example of a very simple code snippet that I'd like to paste to my terminal in a way that everything is executed.
sudo apt update
sudo apt upgrade
sudo apt -y install build-essential
sudo apt -y install git
sudo apt -y install libxml2-dev # required for some tools using xml files
sudo apt autoremove
Unfortunately, what happens if build-essential wasn't installed beforehand is that it only runs until sudo apt -y install build-essential. The subsequent lines are skipped. The same is true if git wasn't installed: It'll run until the git line, then skip the rest.
What's the reason for this happening, and is there a way to fix this problem without having to create a script file and running it via bash?
build-essentialwere to fail, would you want to continue executing the other items?bash, is there a particular problem with creating a script and running that?sudo apt -y install build-essentialis prompting for some specific response (yes, no, something) and it gobbles up your subsequent pasted lines as garbage responses to its prompts, thus never completing.