Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

How to check if ssh-agent is already running in bash

PID_SSH_AGENT=`eval ssh-agent -s | grep -Po "(?<=pid ).*(?=;)"`
Comment

How to check if ssh-agent is already running in bash

if [ $(ps ax | grep [s]sh-agent | wc -l) -gt 0 ] ; then
    echo "ssh-agent is already running"
else
    eval $(ssh-agent -s)
    if [ "$(ssh-add -l)" == "The agent has no identities." ] ; then
        ssh-add ~/.ssh/id_rsa
    fi

    # Don't leave extra agents around: kill it on exit. You may not want this part.
    trap "ssh-agent -k" exit
fi
Comment

PREVIOUS NEXT
Code Example
Shell :: where are dns entries on linux 
Shell :: How to use my windows file through bash 
Shell :: pushing an existing repository from the command line 
Shell :: sed between two patterns 
Shell :: c compiler with working fork 
Shell :: inicializar as credenciais no git 
Shell :: Check /app/package.json: command not found. Is a start script missing? https://help.glitch.com/kb/article/31 
Shell :: solana mint one nft 
Shell :: using docker as a managed vm 
Shell :: gitlab login on terminal 
Shell :: npm install and add to dependancies 
Shell :: git set up 
Shell :: download istioctl 
Shell :: apt slow inside lxc 
Shell :: git push commands 
Shell :: docker compose keep container open 
Shell :: fix node gyp issue on linux 
Shell :: create vue app locally 
Shell :: debian pinning packages 
Shell :: git show signed commit 
Shell :: rename master to main 
Shell :: c# dotnet install Microsoft.Office.Interop.Excel 
Shell :: git clone to specific folder 
Shell :: mocha silent 
Shell :: git checkout -f 
Shell :: vscode terminal shell font broken 
Shell :: pgadmin4 : Depends: libpython3.7 (= 3.7.0) but it is not installable 
Shell :: download powershell 7.2.1 
Shell :: ubuntu windows root directory 
Shell :: pip upgrade version 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =