Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

show env in bash

#show all variable
printenv

#result one variable
echo $LOCALAPPDATA
Comment

read env file bash

env=$(cat server/.env)

my_array=($(echo $env | tr " " "
"))

for i in "${my_array[@]}"
do
    my_nested_array=($(echo $i | tr "=" "
"))
    for j in "${my_nested_array[@]}"
    do
        echo $j
    done
done

# output:
# MY_ENV_VAR
# myenvvalue
# source: https://linuxhandbook.com/bash-split-string/
Comment

PREVIOUS NEXT
Code Example
Shell :: video converter for ubuntu 
Shell :: change ratio vmware ubuntu 
Shell :: node install mint 
Shell :: composer install ubuntu 20.04 
Shell :: how to generate keystore file for cordova 
Shell :: How to check if there are multiple versions of PHP installed on Ubuntu 12.04 LTS? 
Shell :: check changes after git pull 
Shell :: find zombie process PID in linux 
Shell :: how to install gimp in ubuntu 
Shell :: ubuntu 20.04 ntfs read only 
Shell :: install ruby on rails ubuntu 
Shell :: how to start apache/2.4.6 linux 
Shell :: install-nodejs-and-npm 
Shell :: folder size in linux 
Shell :: bash see size of directory 
Shell :: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root? 
Shell :: Git marge branch into master 
Shell :: remove all files with no extention rm 
Shell :: bash random sleep 
Shell :: cut tab linux 
Shell :: python on pop os 
Shell :: ubuntu alien install 
Shell :: stop port 
Shell :: how to download a text file with curl 
Shell :: how to upload code to github 
Shell :: bash while loop 
Shell :: How to download Citrix Workspace for Ubuntu 
Shell :: gcloud set kubectl context 
Shell :: githu copilot 
Shell :: how to run spigot server using bat 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =