DEVenv/Linux/Scripts/node_env.sh

33 lines
692 B
Bash
Executable File

#!/bin/bash
root_path="$devenver_root/NodeJS"
# Check for help argument
if [[ "$1" == "help" || "$1" == "" || "$1" == "--help" || "$1" == "/?" ]]; then
echo "USAGE: node_env.sh <version> <command>"
echo
echo "VERSIONS:"
ls "$root_path"
exit 0
fi
# Check if a version is provided
if [[ -z "$1" ]]; then
echo "Error: No version specified."
echo "USAGE: node_env.sh <version> <command>"
exit 1
fi
# Extract the version and remaining arguments
version="$1"
shift
remaining_args="$@"
# Construct the command to execute
bin_path="$root_path/$version/bin"
# Execute the command
echo "[SCRIPT] Executing $remaining_args"
PATH=${bin_path}:${PATH}
$remaining_args