diff --git a/README.md b/README.md index 70440b2..e4d44f8 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Well now, you can have this, do that for you! 🎊🎊🎊 ## Set up 1. Either download or clone this repo -2. Edit `boot.sh` and change the location on line #5 to the path where your github private key is located. +2. Run `boot.sh` with location of ssh private key as argument 3. Copy the path to the `boot.sh` file by 1. `cd boot-github-shell-win` 2. Copy output of `pwd` @@ -19,4 +19,4 @@ Well now, you can have this, do that for you! 🎊🎊🎊 ## Options -You may opt to print details around the execution by calling the script with the `-v` flag like so: `bash boot.sh -v` \ No newline at end of file +You may opt to print details around the execution by calling the script with additional flag `-v` like so: `bash boot.sh -v` \ No newline at end of file diff --git a/boot.sh b/boot.sh old mode 100644 new mode 100755 index 64f3480..898a76f --- a/boot.sh +++ b/boot.sh @@ -1,30 +1,37 @@ +#!/bin/bash # Boot up github shell access for Windows WSL/Ubuntu. -#!/bin/bash +if [ "$#" -lt 1 ] +then +echo "Please insert at least one argument" +exit +fi -private_key_location=~/.ssh/github_rsa # Change this location to where your file is located. +myArray=( "$@" ) +private_key_location=${myArray[0]} +verbose=${myArray[1]} -verbose=$1 +if [ ! -e $private_key_location ]; then + echo "key $private_key_location not found" + exit +fi echo 'Starting...' -if [ "$1" = "-v" ]; then +if [ "$verbose" = "-v" ]; then echo 'Booting up ssh-agent...' fi -eval `ssh-agent -s` -# ssh_agent_running=$(ssh-agent -s) +ssh_agent_running=$(ssh-agent -s) -if [ "$1" = "-v" ]; then +if [ "$verbose" = "-v" ]; then echo 'ssh-agent started with output:' $ssh_agent_running echo 'Adding private key to ssh-agent...' fi ssh_add_result=$(ssh-add $private_key_location) -if [ "$1" = "-v" ]; then - echo 'ssh-agent started with output:' $ssh_agent_running - echo 'Adding private key to ssh-agent...' +if [ "$verbose" = "-v" ]; then echo 'Command result: '$ssh_add_result fi