accepting location as an input parameter #4
Conversation
Cazaimi
left a comment
There was a problem hiding this comment.
Thanks for the PR @ajaygtm71! Left comments.
| # Boot up github shell access for Windows WSL/Ubuntu. | ||
|
|
||
| #!/bin/bash | ||
| if [ "$#" -lt 1 ] |
There was a problem hiding this comment.
@ajaygtm71 , we want to make the location parameter optional here, and not mandatory. Probably behind a flag such as -l <location> or --location <location>.
| fi | ||
|
|
||
| private_key_location=~/.ssh/github_rsa # Change this location to where your file is located. | ||
| myArray=( "$@" ) |
| exit | ||
| fi | ||
|
|
||
| private_key_location=~/.ssh/github_rsa # Change this location to where your file is located. |
There was a problem hiding this comment.
Don't remove this yet, we can have a fallback.
There was a problem hiding this comment.
you want to keep both ways ie manually editing and optionally passing parameters?
There was a problem hiding this comment.
Yes. As mentioned above, the location parameter is optional.
|
|
||
| eval `ssh-agent -s` | ||
| # ssh_agent_running=$(ssh-agent -s) | ||
| ssh_agent_running=$(ssh-agent -s) |
There was a problem hiding this comment.
Can you test this once? I reckon that this might not work.
There was a problem hiding this comment.
yes the variable is storing the command output.
There was a problem hiding this comment.
Right, but the ssh-agent -s command actually outputs the ssh-agent's pid and the socket location and running the command inside eval stores them as local variables. If the eval is removed, ssh-add will no longer work, as shown below:
| ssh_add_result=$(ssh-add $private_key_location) | ||
|
|
||
| if [ "$1" = "-v" ]; then | ||
| echo 'ssh-agent started with output:' $ssh_agent_running |
There was a problem hiding this comment.
The status messages are a part of the 'verbosity' 😅
There was a problem hiding this comment.
same msg is already there in previous if block. so I removed from here
| exit | ||
| fi | ||
|
|
||
| private_key_location=~/.ssh/github_rsa # Change this location to where your file is located. |
There was a problem hiding this comment.
Yes. As mentioned above, the location parameter is optional.
|
|
||
| eval `ssh-agent -s` | ||
| # ssh_agent_running=$(ssh-agent -s) | ||
| ssh_agent_running=$(ssh-agent -s) |
There was a problem hiding this comment.
Right, but the ssh-agent -s command actually outputs the ssh-agent's pid and the socket location and running the command inside eval stores them as local variables. If the eval is removed, ssh-add will no longer work, as shown below:
|
|
||
| eval `ssh-agent -s` | ||
| # ssh_agent_running=$(ssh-agent -s) | ||
| ssh_agent_running=$(ssh-agent -s) |

Solves #3