~tardypad/dotfiles

ref: HEAD dotfiles/setup/substitute-dirs -rwxr-xr-x 451 bytes
56d57f55Damien Tardy-Panis Fix aerc bindings for Backup account 6 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

SCRIPT_FILE="build/substitute-dirs"

if [ -f "${SCRIPT_FILE}" ]; then
  sed -f "${SCRIPT_FILE}" -
  exit
fi

DIRS_FILE="config/dirs"

mkdir -p build

{
  while read -r LINE; do
    ALIAS=$( echo "${LINE}" | cut -f1 -d' ' )
    DIR_PATH=$( echo "${LINE}" | tr -s ' ' | cut -f2 -d' ' )
    DIR_PATH=$( eval "echo ${DIR_PATH}" )
    echo "s|{dir/${ALIAS}}|${DIR_PATH}|g"
  done < "${DIRS_FILE}"
} > "${SCRIPT_FILE}"

sed -f "${SCRIPT_FILE}" -