I'm trying to use blender as a part of a larger script, as such I wanted to run Blender a couple of times to figure out some important environment settings, something along the lines:
blender=${1:-blender}
python=$(${blender} --background --python-expr "import sys; print(sys.executable)")
addons=$(${blender} --background --python-expr "import bpy; print(bpy.utils.user_resource('SCRIPTS', path='addons'))")
echo ${python}
echo ${addons}
While this works, Blender outputs a lot of extra junk after the print, e.g.:
/Applications/Blender.app/Contents/Resources/3.4/python/bin/python3.10 Blender 3.4.1 (hash 55485cb379f7 built 2022-12-20 00:48:52) Read prefs: /Users/gustaf/Library/Application Support/Blender/3.4/config/userpref.blend Blender quit
/Users/gustaf/Library/Application Support/Blender/3.4/scripts/addons Blender 3.4.1 (hash 55485cb379f7 built 2022-12-20 00:48:52) Read prefs: /Users/gustaf/Library/Application Support/Blender/3.4/config/userpref.blend Blender quit
Is it possible to tell Blender to suppress the remaining (uninteresting) output? I.e., avoid printing this:
Blender 3.4.1 (hash 55485cb379f7 built 2022-12-20 00:48:52) Read prefs: /Users/gustaf/Library/Application Support/Blender/3.4/config/userpref.blend Blender quit