# Gathering the outdated packages list echo "Gathering the outdated packages list..." py_pkglist=$(pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d '=' -f 1) # Updating if [ ! -z "$py_pkglist" ]; then echo $py_pkglist | xargs -n 1 pip3 install -U else echo "All packages are up to date." fi # Unsetting the variable unset py_pkglist