Skip to content

Instantly share code, notes, and snippets.

@jfut
Last active June 16, 2021 06:43
Show Gist options
  • Save jfut/7bc3fa9c9e3319b602d3e011d64019c1 to your computer and use it in GitHub Desktop.
Save jfut/7bc3fa9c9e3319b602d3e011d64019c1 to your computer and use it in GitHub Desktop.
scoop-list-for-migration
#!/bin/bash
#
# scoop list for migration
APP_FAILED=""
APP_UNKOWN=""
APP_GLOBAL=""
APP_USER=""
IFS='
'
APP_LIST=$(scoop list)
for i in ${APP_LIST}
do
APP=$(echo ${i} | awk '{ print $1 }')
GLOBAL=$(echo ${i} | awk '{ print $3 }')
BUCKET=$(echo ${i} | awk '{ print $4 }')
if [[ -z "${GLOBAL}" ]]; then
continue
elif [[ "${GLOBAL}" = "*failed*" ]]; then
APP_FAILED="${APP_FAILED} ${APP}"
elif [[ "${BUCKET}" =~ "\\" ]]; then
APP_UNKOWN="${APP_UNKOWN} ${APP}"
elif [[ "${GLOBAL}" = "*global*" ]]; then
APP_GLOBAL="${APP_GLOBAL} ${APP}"
else
APP_USER="${APP_USER} ${APP}"
fi
done
echo "# failed"
echo "${APP_FAILED}"
echo
echo "# unkown bucket"
echo "${APP_UNKOWN}"
echo
echo "# global"
echo "sudo scoop install -g${APP_GLOBAL}"
echo
echo "# user"
echo "scoop install${APP_USER}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment