I would like to store command output in variable in bash but I don't know why with this command I can't...
The command alone :
su plex -s /bin/bash -c "export LD_LIBRARY_PATH='/usr/lib/plexmediaserver' && /usr/lib/plexmediaserver/Plex\ Media\ Scanner --list"
Return :
4: ANIMATIONS
3: CARTOONS
1: MOVIESHD
9: MUSIC
2: TVSHOWS
Here is what I am doing to store the result :
OUTPUT=$(su plex -c "export LD_LIBRARY_PATH='/usr/lib/plexmediaserver' && /usr/lib/plexmediaserver/Plex\ Media\ Scanner --list");
echo "$OUTPUT"
Unfortunately my var OUTPUT is empty.
I tried many variant (with "",``,..) without success.
Perhaps it's because the result come from another user (plex) ?
Can somebody help me please ?