How to write a script bash to enter multi-line input in jupyter-notebook?
For your particular case, you can simply use semicolon at the end to run it i.e.
!(python --version; \ which python; \ pip --version; \ conda --version; \ which conda) >> config-environment.txt
For general case, you can use %%bash
cell magic command to run the cell in bash i.e.
%%bash script magic
Run cells with bash in a subprocess.
%%bash(python --version which python pip --version conda --version which conda) >> config-environment.txt
You can also have a look at subprocess
python module.