Reputation: 1
In a program for Linux, I use this script (with root execution) to get last logged user and its locale:
LAST_USER=`last -1 | cut -f 1 -d " " | head -n 1`
LAST_LOCALE=`su - "$LAST_USER" -c 'echo "$LANG"'`
But one of the Linux agent using this script adds an hardstatus (eg. "\033];hostname\033\") in the beginning of $LAST_LOCALE and I can't figure out why.
I tried to reproduce this issue on a local Linux without success ; I tried to ask the user to do the command without the '-' option of su, without changes. Replacing 'echo' by 'printf' seems to remove the hardstatus though, so the issue seems to be linked with 'echo' itself.
I couldn't find any similar behavior with a lots of internet researching…
Note: the user is using tmux.
Upvotes: 0
Views: 34