Include commad to load shell configuration after installation for Linux and MacOS #100
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
The PATH environment variable does not get updated after running the
install.sh
script,As a result the user would have to manually source the shell configuration file in order to update the environment variables or open a new terminal session.
Even though the below conditional statement to source the configuration file is present in install.sh at the end of file
But it won't work (in some cases it will) because shell scripts by default run in a non interactive shell and source command only works when the shell is in interactive mode. Which means the environment variables declared or updated while running the
install.sh
file won't be reflected in the user's shell.What is changing
A case statement has been added below the previous command which was used to run
install.sh
so that the configuration can be sourced in the interactive shell and the environment variables are updated in the same shell instance.Why did I use this approach to check shell type?
You might notice I used
"$SHELL" in *bash*
approach which basically is checking a sub string instead of explicitly doing$SHELL=="/bin/bash"
This approach have some added advantages to it instead of explicit check of shell path'
/usr/bin/bash
or/usr/bin/zsh
/bin/bash
or/usr/bin/bash
How to test
To test you will first need to uninstall the existing install (if present) using
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/AssemblyAI/assemblyai-cli/main/uninstall.sh)"
and load the latest shell configuration using the above command we used before.Verify that the
assemblyai
is not within thePATH
entering it on terminalNow Install the script again using
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/AssemblyAI/assemblyai-cli/main/install.sh)"
and run the command for loading the shell configuration we used before.As you can see below it updated the environment variable and now the user can access the
assemblyai