iokanuon
Joined 11 years ago
Karma
633
Submissions
122
Member since
Jan 31
Joined 11 years ago
loadenv() {
case "$-" in
*a*) source ./.env ;;
*) set -a; source ./.env; set +a ;;
esac
}
Although I have yet to see a long shellscript utilise `set -a` globally :) loadenv() {
set -a
source ./.env
set +a
} sh -ac '. ./.env; ./prog'
Also if you use the `.` builtin it's a good idea to specify the path with a slash in it, so that `.` doesn't search $PATH first.Could you possibly do something similar?
It's worth noting that `-br` gives you a brief version of the output, and `-c` colors it, so that it's possible to do something like this:
ip -br -c addr
to get a very readable and colorful table-like output.There's also `-j` for JSON, and `-j -p` for pretty JSON.