[arch-general] How to suppress the list of variables that are output at shell login?
Dave Reisner
d at falconindy.com
Mon Jan 7 08:08:01 EST 2013
On Mon, Jan 07, 2013 at 05:51:39PM +0530, Jayesh Badwaik wrote:
> Hi,
>
> On Mon, Jan 7, 2013 at 5:18 PM, Rodrigo Rivas
> <rodrigorivascosta at gmail.com> wrote:
> > You may also add a `echo $profile` command in the /etc/profile file, just
> > after `for profile in /etc/profile.d/*.sh; do` to see the trace of sourced
> > files.
>
> Thanks for the suggestion. I implemented this and got the following output.
> /etc/profile.d/gpg-agent.sh
No package owns this file. Where did it come from?
> declare -x HOME="/root"
> declare -x LOGNAME="root"
> declare -x OLDPWD
> declare -x PATH="/usr/bin:/usr/local/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
> declare -x PWD="/root"
> declare -x SHELL="/bin/bash"
> declare -x SHLVL="1"
> declare -x TERM="xterm"
> declare -x USER="root"
> /etc/profile.d/gpm.sh
> /etc/profile.d/jdk.sh
>
> I guess, this means the gpg-agent.sh is the one outputting all the
> terms. So, I read the gpg-agent.sh and here is the output for the
> same:
> if pgrep -u "${USER}" gpg-agent >/dev/null 2>&1; then
> eval `cat $gnupginf`
> eval `cut -d= -f1 $gnupginf | xargs echo export`
> else
> eval `gpg-agent --enable-ssh-support --daemon`
> fi
Ew.
>
>
> And after commenting lines selectively, the line
>
> eval `cut -d= -f1 $gnupginf | xargs echo export`
>
> seems to be outputting all the variables. I am not sure what this line
> does exactly. I am guessing that it checks if the gpg daemon is on,
> and if it is not, it turns it on, and if it is, it lists some
> environment variables, according to some condition. I am not sure
> which.
>
> Is my guess correct? In which case, would it be safe to comment the lines?
No, this happens because nothing is passed to xargs, which results in:
eval `echo export`
Or, simple running 'export'. You'll see that running export without any
arguments simply dumps a list of exported variables.
I'd suggest removing this file entirely if no package owns it and using
something like keychain if you want a singleton ssh-agent for your user.
More information about the arch-general
mailing list