if [ "${_FILENAME}" = 'KILL_ME' ]; then # only there to ensure directory
continue
fi
- if $(echo "${_FILENAME}" | grep -E '^LINK_ME'); then
+ if [ $(echo "${_FILENAME}" | grep -E '^LINK_ME' | wc -l) -gt 0 ]; then
_LINK_TARGET=$(cat "${_PATH_REL}" | head -1)
_LINK_NAME=$(cat "${_PATH_REL}" | tail -1)
if [ -z "${_LINK_NAME}" ]; then
# for all paths written into user home directories, chown to respective users
for _PATH in ${_PATHS_WRITTEN}; do
- if $(echo "${_PATH}" | grep -E '^/home/'); then
+ if [ $(echo "${_PATH}" | grep -E '^/home/' | wc -l) -gt 0 ]; then
_USERNAME=$(echo "${_PATH}" | sed -E '/^\/home\///' | sed -E '/\/.*//i')
chown -R "${_USERNAME}:${_USERNAME}" "${_PATH}"
fi