#!/usr/bin/env bash # just to prevent error on shelling cd $SNAP snapctl is-connected bin if [ $? -eq 0 ]; then readarray -d '' PATHS < <(find $SNAP -maxdepth 2 -type d -name bin -path "$SNAP/shared-bin*" -print0) if [ "${#PATHS[@]}" -ne 0 ]; then for TPATH in "${PATHS[@]}"; do export PATH="${PATH}:${TPATH}" done fi fi # Add sub directories of lib-path; (e.g pulseaudio) readarray -d '' PATHS < <(find "$SNAP/usr/lib/$(uname -m)-linux-gnu" -maxdepth 1 -type d -print0) if [ "${#PATHS[@]}" -ne 0 ]; then for TPATH in "${PATHS[@]}"; do export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${TPATH}" done fi eval $@