dotfiles/dotscripts/gen/fish-exportenvs

26 lines
584 B
Bash
Executable File

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