Last active
February 9, 2022 21:06
-
-
Save bashkirtsevich/1e2b843b566b21ec95c8469849420c1a to your computer and use it in GitHub Desktop.
Enum os envs values by pattern
This file contains hidden or 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
#!/bin/sh | |
vals="" | |
while read -r line ; do | |
val=$(echo $line | cut -d= -f2) | |
vals+="$val " | |
done < <(env | grep ENV) | |
for val in $vals ; do | |
echo "Found val $val" | |
done | |
# bad solutions: | |
env | grep ENV | while read -r it ; do echo $(echo $it | cut -d= -f2) ; done; | |
env | grep ENV | while read -r it ; | |
do | |
value=$(echo $it | cut -d= -f2) | |
echo $value | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment