Re: OT: Bash: what is eval doing here?
- To: debian-user@lists.debian.org
- Subject: Re: OT: Bash: what is eval doing here?
- From: Kamil Jońca <kjonca@o2.pl>
- Date: Fri, 10 Jun 2022 17:40:48 +0200
- Message-id: <[🔎] 87ilp8plvj.fsf@alfa.kjonca>
- In-reply-to: <EwOKd-3UNp-7@gated-at.bofh.it> (rhkramer@gmail.com's message of "Fri, 10 Jun 2022 17:30:01 +0200")
- References: <EwOKd-3UNp-7@gated-at.bofh.it>
rhkramer@gmail.com writes:
> In my (seemingly unending) quest to understand ssh, I've come across a
> document that calls for running =eval 'ssh-agent'= from a command line.
>
> I wondered why, as I thought I would get the same result from just running
> =ssh-agent=, but the results are different -- see below:
>
> $ eval `ssh-agent`
> Agent pid 23929
>
> $ ssh-agent
> SSH_AUTH_SOCK=/tmp/ssh-uLqQ9VWX0RL7/agent.23932; export SSH_AUTH_SOCK;
> SSH_AGENT_PID=23933; export SSH_AGENT_PID;
> echo Agent pid 23933;
>
> Can anybody on here explain what is going on / why?
ssh-agents prints details about its config (i.e. where ssh should search
authentication agent) - and thats all. (these are SSH_AUTH_SOCK et al.)
eval `` in turn takes these statements and try to evaluate them
(i.e. creates these two variables in environment)
as an example try
--8<---------------cut here---------------start------------->8---
$echo "KJONCA_VAR=this_is_test"
$set | grep KJONCA
$eval $(echo "KJONCA_VAR=this_is_test")
$set |grep KJONCA
--8<---------------cut here---------------end--------------->8---
KJ
--
http://stopstopnop.pl/stop_stopnop.pl_o_nas.html
Reply to: