Created
April 10, 2023 05:45
-
-
Save jrichardsz/ba3f26e199803e516af326b23372d6eb to your computer and use it in GitHub Desktop.
maven helper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mvn_detect() { | |
maven_version=$(mvn -v > /dev/null 2>&1) | |
status=$? | |
echo $status | |
} | |
java_detect() { | |
java_version=$(java -version > /dev/null 2>&1) | |
status=$? | |
echo $status | |
} | |
sudo_detect() { | |
prompt=$(sudo -nv > /dev/null 2>&1) | |
status=$? | |
echo $status | |
} | |
echo "Hello I am the maven version manager wellknowed as mvm" | |
if [ "$(sudo_detect)" -eq "0" ]; then | |
echo ">> sudo is allowed" | |
if [ "$(java_detect)" -eq "0" ]; then | |
echo ">> java is available" | |
if [ "$(mvn_detect)" -eq "0" ]; then | |
echo ">> mvn is already in this machine." | |
else | |
echo ">> mvn is not available in this machine." | |
fi | |
else | |
echo ">> java is not installed. Java is required to maven installation" | |
fi | |
else | |
echo "sudo is not allowed. Bye!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment