diff --git a/$HOME/.bashrc b/$HOME/.bashrc index 1cead28..c0cbb7f 100644 --- a/$HOME/.bashrc +++ b/$HOME/.bashrc @@ -1,51 +1,66 @@ #!/bin/bash -# Author: Esteban Márquez D. @https://www.github.com/EstebanMqz -# Description: User/Sys Linux Envs & PATHs startup file when terminal is launched. - -# Define the environment variables and their directories: -declare -A env_vars=( - ["VSCode"]="/c/Users/Esteban/AppData/Local/Programs/Microsoft VS Code" - ["Python311-Lib"]="/c/Users/Esteban/AppData/Local/Programs/Python/Python311/Lib/site-packages" - ["Python311-python.exe"]="/c/Users/Esteban/AppData/Local/Programs/Python/Python311" - ["Python311-Scripts"]="/c/Users/Esteban/AppData/Local/Programs/Python/Python311/Scripts" - ["Python312-Lib"]="/c/Users/Esteban/AppData/Local/Programs/Python/Python312/Lib/site-packages" - ["Python312-python.exe"]="/c/Users/Esteban/AppData/Local/Programs/Python/Python312" - ["Python312-Scripts"]="/c/Users/Esteban/AppData/Local/Programs/Python/Python312/Scripts" - ["Local-Temp"]="/c/Users/Esteban/AppData/Local/Temp" - ["Anaconda3"]="/c/ProgramData/Anaconda3" - ["anaconda.exe"]="/c/ProgramData/Anaconda3/Scripts/anaconda-navigator.exe" - ["ComposerSetup"]="/c/ProgramData/ComposerSetup" - ["dotnet"]="/c/Program Files/dotnet" - ["Git"]="/c/Program Files/Git/cmd" - ["MATLAB"]="/c/Program Files/MATLAB/R2021a/bin" - ["nodejs"]="/c/Program Files/nodejs" - ["NVIDIA "]="/c/Program Files/NVIDIA Corporation" - ["R-4.2.2"]="/c/Program Files/R/R-4.2.2" - ["php-8.2.9"]="/c/php-8.2.9" - ["bun"]="c/Users/Esteban/.bun/bin/bun.exe" - [".NET"]="/c/Windows/Microsoft.NET/Framework64/v4.0.30319/csc.exe" - ["WindowsPowershell"]="/c/Windows/System32/WindowsPowerShell/v1.0" - ["Wbem"]="/c/Windows/System32/Wbem" - ["OpenSSH"]="/c/Windows/System32/OpenSSH" - ["PhysX"]="/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common" - ["NvDLISR"]="/c/Program Files/NVIDIA Corporation/NvDLISR" #To interact directly with ML & img process - ["WindowsPowerShell"]="/c/Windows/System32/WindowsPowerShell/v1.0" - ["system32"]="/c/Windows/system32" #System built-in var & wbem - ["OpenSSH"]="/c/Windows/System32/OpenSSH" +# Description: Exports Environment Variables & PATHs if necessary, NVM & Node.js with Bash Initalization & Auto-completion. + +#CREATE/OPEN (.sh): cd $HOME & code ~/.bashrc + + +Environment=(VSCode Python311Lib Python11exe Python311Scripts Python312Lib Python12exe Python312Scripts LocalTemp Anaconda3 Anaconda3exe ComposerSetup dotnet Git MATLAB nodejs NVIDIA R422 php bun NET WindowsPowershell PhysX NvDLISR system32) + +directories=( +"/c/Users/Esteban/AppData/Local/Programs/Microsoft VS Code" +"/c/Users/Esteban/AppData/Local/Programs/Python/Python311/Lib/site-packages" +"/c/Users/Esteban/AppData/Local/Programs/Python/Python311/python.exe" +"/c/Users/Esteban/AppData/Local/Programs/Python/Python311/Scripts" +"/c/Users/Esteban/AppData/Local/Programs/Python/Python312/Lib/site-packages" +"/c/Users/Esteban/AppData/Local/Programs/Python/Python312/python.exe" +"/c/Users/Esteban/AppData/Local/Programs/Python/Python312/Scripts" +"/c/Users/Esteban/AppData/Local/Temp" +"/c/ProgramData/Anaconda3" +"/c/ProgramData/Anaconda3/Scripts/anaconda-navigator.exe" +"/c/ProgramData/ComposerSetup" +"/c/Program Files/dotnet" +"/c/Program Files/Git/cmd" +"/c/Program Files/MATLAB/R2021a/bin" +"/c/Program Files/nodejs" +"/c/Program Files/NVIDIA Corporation" +"/c/Program Files/R/R-4.2.2" +"/c/php-8.2.9" +"c/Users/Esteban/.bun/bin/bun.exe" +"/c/Windows/Microsoft.NET/Framework64/v4.0.30319/csc.exe" +"/c/Windows/System32/WindowsPowerShell/v1.0" +"/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common" +"/c/Program Files/NVIDIA Corporation/NvDLISR" +"/c/Windows/system32" ) -# Export Variables and directories to PATHs if not already there. -for var in "${!env_vars[@]}"; do - export "$var"="${env_vars[$var]}" - if [[ ":$PATH:" != *":${env_vars[$var]}:"* ]]; then - export PATH="$PATH:${env_vars[$var]}" - fi +# Export PATHs if necessary. +for dir in "${directories[@]}" +do + if [[ ":$PATH:" != *":$dir:"* ]]; then + export PATH="$PATH:$dir" + fi done -# NVM initalization in bash & enable NVM command Auto-Completion. + +# Set Environment Variables if necessary. +for i in "${!Environment[@]}"; do + var=${Environment[i]} + if [[ -z "${!var}" ]]; then + export "${Environment[i]}"="${directories[i]}" + fi +done + +# NVM $HOME initalization in Bash & enable NVM commands Auto Completion. export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh"] && \. "$NVM_DIR/nvm.sh" -[ -s "$NVM_DIR/bash_completion"] && \. "$NVM_DIR/bash_completion" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" + +# Node.js/npm & binaries accesible in PATHs. +node_bin_path="$NVM_DIR/versions/node/v21.6.1/bin" +export PATH="$PATH:$node_bin_path" +export PATH="$PATH:$NVM_DIR/versions/node/$(nvm current)/bin" + +# Author: Esteban Márquez D. @https://www.github.com/EstebanMqz +# References: https://github.com/EstebanMqz/Registries/blob/main/$HOME/.bashrc -# References: -#[![.bashrc](https://img.shields.io/badge/~/.profile-000000.svg?style=flat&logo=git&logoColor=orange)](https://github.com/EstebanMqz/Registries/blob/main/%24HOME/.profile) +# Badge: #[![.bashrc](https://img.shields.io/badge/~/.profile-000000.svg?style=flat&logo=git&logoColor=orange)](https://github.com/EstebanMqz/Registries/blob/main/$HOME/.profile) diff --git a/$HOME/.profile b/$HOME/.profile index 3c1d5df..f6a62cd 100644 --- a/$HOME/.profile +++ b/$HOME/.profile @@ -1,55 +1,73 @@ #!/bin/bash -# Author: Esteban Márquez D. @https://www.github.com/EstebanMqz -# Description: User/Sys Linux Envs & PATHs startup file when terminal is launched. - -# Define the environment variables and their directories: -declare -A env_vars=( - ["VSCode"]="/c/Users/Esteban/AppData/Local/Programs/Microsoft VS Code" - ["Python311-Lib"]="/c/Users/Esteban/AppData/Local/Programs/Python/Python311/Lib/site-packages" - ["Python311-python.exe"]="/c/Users/Esteban/AppData/Local/Programs/Python/Python311" - ["Python311-Scripts"]="/c/Users/Esteban/AppData/Local/Programs/Python/Python311/Scripts" - ["Python312-Lib"]="/c/Users/Esteban/AppData/Local/Programs/Python/Python312/Lib/site-packages" - ["Python312-python.exe"]="/c/Users/Esteban/AppData/Local/Programs/Python/Python312" - ["Python312-Scripts"]="/c/Users/Esteban/AppData/Local/Programs/Python/Python312/Scripts" - ["Local-Temp"]="/c/Users/Esteban/AppData/Local/Temp" - ["Anaconda3"]="/c/ProgramData/Anaconda3" - ["anaconda.exe"]="/c/ProgramData/Anaconda3/Scripts/anaconda-navigator.exe" - ["ComposerSetup"]="/c/ProgramData/ComposerSetup" - ["dotnet"]="/c/Program Files/dotnet" - ["Git"]="/c/Program Files/Git/cmd" - ["MATLAB"]="/c/Program Files/MATLAB/R2021a/bin" - ["nodejs"]="/c/Program Files/nodejs" - ["NVIDIA "]="/c/Program Files/NVIDIA Corporation" - ["R-4.2.2"]="/c/Program Files/R/R-4.2.2" - ["php-8.2.9"]="/c/php-8.2.9" - ["bun"]="c/Users/Esteban/.bun/bin/bun.exe" - [".NET"]="/c/Windows/Microsoft.NET/Framework64/v4.0.30319/csc.exe" - ["WindowsPowershell"]="/c/Windows/System32/WindowsPowerShell/v1.0" - ["Wbem"]="/c/Windows/System32/Wbem" - ["OpenSSH"]="/c/Windows/System32/OpenSSH" - ["PhysX"]="/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common" - ["NvDLISR"]="/c/Program Files/NVIDIA Corporation/NvDLISR" #To interact directly with ML & img process - ["WindowsPowerShell"]="/c/Windows/System32/WindowsPowerShell/v1.0" - ["system32"]="/c/Windows/system32" #System built-in var & wbem - ["OpenSSH"]="/c/Windows/System32/OpenSSH" +# Description: Exports Environment Variables & PATHs if necessary, NVM & Node.js with Bash Initalization & Auto-completion & Source ./bashrc to ./profile. to match unix-like envs. + +#CREATE/OPEN (.sh): cd $HOME & code ~/.profile + + +Environment=(VSCode Python311Lib Python11exe Python311Scripts Python312Lib Python12exe Python312Scripts LocalTemp Anaconda3 Anaconda3exe ComposerSetup dotnet Git MATLAB nodejs NVIDIA R422 php bun NET WindowsPowershell PhysX NvDLISR system32) + +directories=( +"/c/Users/Esteban/AppData/Local/Programs/Microsoft VS Code" +"/c/Users/Esteban/AppData/Local/Programs/Python/Python311/Lib/site-packages" +"/c/Users/Esteban/AppData/Local/Programs/Python/Python311/python.exe" +"/c/Users/Esteban/AppData/Local/Programs/Python/Python311/Scripts" +"/c/Users/Esteban/AppData/Local/Programs/Python/Python312/Lib/site-packages" +"/c/Users/Esteban/AppData/Local/Programs/Python/Python312/python.exe" +"/c/Users/Esteban/AppData/Local/Programs/Python/Python312/Scripts" +"/c/Users/Esteban/AppData/Local/Temp" +"/c/ProgramData/Anaconda3" +"/c/ProgramData/Anaconda3/Scripts/anaconda-navigator.exe" +"/c/ProgramData/ComposerSetup" +"/c/Program Files/dotnet" +"/c/Program Files/Git/cmd" +"/c/Program Files/MATLAB/R2021a/bin" +"/c/Program Files/nodejs" +"/c/Program Files/NVIDIA Corporation" +"/c/Program Files/R/R-4.2.2" +"/c/php-8.2.9" +"c/Users/Esteban/.bun/bin/bun.exe" +"/c/Windows/Microsoft.NET/Framework64/v4.0.30319/csc.exe" +"/c/Windows/System32/WindowsPowerShell/v1.0" +"/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common" +"/c/Program Files/NVIDIA Corporation/NvDLISR" +"/c/Windows/system32" ) -# Export Variables and directories to PATHs if not already there. -for var in "${!env_vars[@]}"; do - export "$var"="${env_vars[$var]}" - if [[ ":$PATH:" != *":${env_vars[$var]}:"* ]]; then - export PATH="$PATH:${env_vars[$var]}" - fi +# Export PATHs if necessary. +for dir in "${directories[@]}" +do + if [[ ":$PATH:" != *":$dir:"* ]]; then + export PATH="$PATH:$dir" + fi done -# NVM initalization in bash & enable NVM command Auto-Completion. +# Set Environment Variables if necessary. +for i in "${!Environment[@]}"; do + var=${Environment[i]} + if [[ -z "${!var}" ]]; then + export "${Environment[i]}"="${directories[i]}" + fi +done + +# NVM $HOME initalization in Bash & enable NVM commands auto completion. export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh"] && \. "$NVM_DIR/nvm.sh" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/bash_completion"] && \. "$NVM_DIR/bash_completion" -source ~/.bashrc #Ensure that startup environments and directories in ~/.profile are available in terminals. +# Node.js/npm & binaries accesible in PATHs. +node_bin_path="$NVM_DIR/versions/node/v21.6.1/bin" +export PATH="$PATH:$node_bin_path" +export PATH="$PATH:$NVM_DIR/versions/node/$(nvm current)/bin" + +# Source ./bashrc to ./profile. +if [ -n "$BASH_VERSION" ]; then + if [ -f "$HOME/.bashrc" ]; then + . "$HOME/.bashrc" + fi +fi + +# Author: Esteban Márquez D. @https://www.github.com/EstebanMqz +# References: https://github.com/EstebanMqz/Registries/blob/main/$HOME/.profile -# References: -# ~/.profile #Loaded when USER's startups. -#[![.profile](https://img.shields.io/badge/~/.profile-000000.svg?style=flat&logo=git&logoColor=orange)](https://github.com/EstebanMqz/Registries/blob/main/%24HOME/.profile) +# Badge: #[![.profile](https://img.shields.io/badge/~/.profile-000000.svg?style=flat&logo=git&logoColor=orange)](https://github.com/EstebanMqz/Registries/blob/main/$HOME/.profile) diff --git a/.sh/System_Environments.sh b/.sh/System_Environments.sh deleted file mode 100644 index a28c201..0000000 --- a/.sh/System_Environments.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -# Author: Esteban Márquez D. @https://www.github.com/EstebanMqz -# Description: User/Sys Windows Env & PATH Variables startup file. -# CREATE/OPEN Server Startup Files .bashrc & .profile - -#Copy the following Envs/Dirs accordingly to their PATHS for your OS Env Vars Startup files: - -Environment=(PhysX NvDLISR system32 MATLAB dotnet nodejs php_8_2_9 ComposerSetup Git anaconda_navigator Python311 VS WindowsPowerShell Wbem System32) - -Environment=(PhysX system32 MATLAB dotnet nodejs php_8_2_9 ComposerSetup Git Anaconda_navigator Python311 VS WindowsPowerShell Wbem System32) - -directories=( -"/C/Program Files (x86)/NVIDIA Corporation/PhysX/Common" -"/C/Windows/system32" -"/C/Program Files/MATLAB/R2021a/bin" -"/C/Program Files/dotnet" -"/C/Program Files/nodejs" -"/C/php-8.2.9" -"/C/ProgramData/ComposerSetup/bin" -"/C/Program Files/Git/cmd" -"/C/ProgramData/Anaconda3/Scripts" -"/C/Users/Esteban/AppData/Local/Programs/Python/Python311/Scripts" -"/C/Users/Esteban/AppData/Local/Programs/Microsoft VS Code/bin" -"/C/Windows/System32/WindowsPowerShell/v1.0" -"/C/Windows/System32/Wbem" -"/C/Windows/System32/OpenSSH" -) - -for dir in "${directories[@]}" -do - if [[ ":$PATH:" != *":$dir:"* ]]; then - export PATH="$PATH:$dir" - fi -done - -for index in ${!Environment[*]}; do - export ${Environment[$index]}="${directories[$index]}" -done - -# References: -# Load when Terminals are launched. diff --git a/env_vars.txt b/env_vars.txt deleted file mode 100644 index 33ac8e8..0000000 Binary files a/env_vars.txt and /dev/null differ