Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

pipで一括アップデート(確認付き)

こんにちは。
pipで一括アップデート」を少し拡張し、一括アップデートの確認( [upgrade all? (y/n)])をつけたシェルスクリプトに仕立ててみました。

pip_upgrade_all.sh
#!/bin/sh
PIP="pip"
OUTDATED=$(${PIP} list --format=columns --outdated | awk 'NR>=3 {print $1}')
[ -z "${OUTDATED}" ] && exit $?
echo "${OUTDATED}"
echo "[upgrade all? (y/n)]"
read -r KEYINPUT
[ "${KEYINPUT}" = "y" ] && echo "${OUTDATED}" | xargs ${PIP} install --upgrade
exit $?

なお確認無しで実行するワンライナーは、

$ pip list --format=columns --outdated | awk 'NR>=3 {print $1}' | xargs pip install --upgrade
kkdd
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away