dotfiles/dotscripts/gen/fish-exportenvs

26 lines
584 B
Plaintext
Raw Permalink Normal View History

2023-01-13 09:13:11 +00:00
#!/usr/bin/env bash
2023-01-13 11:59:10 +00:00
# TODO: Use awk instead
# Stubbornly translates ~/.exportenvs to ~/.exportenvs.fish
echo "" > ~/.exportenvs.fish # clear the file
2023-01-13 11:59:10 +00:00
first=1
2023-01-13 09:13:11 +00:00
while read fileline; do
2023-01-13 11:59:10 +00:00
if [ $first = 1 ]; then
first=0
continue
fi
line=$(echo "$fileline" | sed 's/#.*//' | sed 's/export //')
2023-01-13 09:13:11 +00:00
if [ -z "$line" ]; then
echo "Adding '$fileline' as-is"
echo "$fileline" >> ~/.exportenvs.fish
continue
2023-01-13 09:13:11 +00:00
fi
tline=$(echo "$line" | sed 's/=/ /')
echo Adding "$tline"
echo "set -x $tline" >> ~/.exportenvs.fish
done < ~/.exportenvs