#!/usr/bin/env sh while IFS= read -r -d $'\0'; do CACHEDIR=$(grep '^Exec' "${REPLY}" | sed "s/Exec=.* --user-data-dir='\(.*\)'/\1/g" | sed "s/'.*//g") if [ -d "${CACHEDIR}" ]; then printf '\r\033[K%s' "${CACHEDIR}" else cp -r "${CACHEDIR/pwa-*/pwa-default}" "${CACHEDIR}" printf '\r\033[KCreated %s\n' "${CACHEDIR}" fi done < <(find "${HOME}/.local/share/applications/pwa" -type f -name '*.desktop' -print0) printf '\r\033[K'