GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu), Ubuntu 16.04.3 LTS.
I need to obtain a value of DBUS_SESSION_BUS_ADDRESS and save it to a file.
If I run set | grep DBUS_SESSION_BUS_ADDRESS > /home/user/.DBUS_temp in Bash I have something similar to DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-N1wmwpEVBj in the .DBUS_temp file which is OK.
But when I try to run the command in script the following happens:
- An empty file is created if
set | grep DBUS_SESSION_BUS_ADDRESS > /home/user/.DBUS_tempis used. BASH_EXECUTION_STRING='set | grep DBUS_SESSION_BUS_ADDRESS > /home/user/.DBUS_temp'is in the file ifsu -c 'set | grep DBUS_SESSION_BUS_ADDRESS > /home/user/.DBUS_temp' useris used.
What is wrong in my code/implementation?
Thank you for your time.