Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

read from .env file bash

set -o allexport
source conf-file
set +o allexport
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 :: install serverless framework 
Shell :: how to check which shell 
Shell :: ignore file git 
Shell :: run command as root administrator mac 
Shell :: change directory, files and sub-directories owner in linux 
Shell :: Flutter Git-Chrome-OS 
Shell :: how to give full permission to another user linux 
Shell :: instal kdenlive 
Shell :: get a loading spinner javascript react 
Shell :: what is the ssh credentials for minikube 
Shell :: kube log 
Shell :: install docke machine 
Shell :: how to execute a bash script in terminal 
Shell :: how to restore a mongodb dump with a new name 
Shell :: git merge branch to master 
Shell :: bash add help argument 
Shell :: add changes from different branch 
Shell :: github fork my own repo 
Shell :: cmd refresh path 
Shell :: putty for ubuntu 
Shell :: clone at a given commit github 
Shell :: list all files in a directory linux 
Shell :: copy from remote server 
Shell :: ssh server windows 11 
Shell :: installing gnome 
Shell :: create new branch git from master 
Shell :: install helm on minikube 
Shell :: get only file names from CMD 
Shell :: bash arrays 
Shell :: mac shell prompt 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =