Created
September 27, 2021 16:58
-
-
Save tychobrailleur/1d694d66cffa3338920b63520c65bfa4 to your computer and use it in GitHub Desktop.
Experiment with env variables in bash
This file contains 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
#!/usr/bin/env bash | |
# Call script with: | |
# VAL=pouet ./my-script.bash | |
var_val="${VAL}" | |
echo ${var_val} | |
output="$( | |
echo "[${VAL}]" | |
)" | |
echo $output | |
output="$( | |
VAL=pouetpouet; echo "[${VAL}]" | |
)" | |
echo $output | |
output="$( | |
VAL=pouetpouetpouet echo "[${VAL}]" | |
)" | |
echo $output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment