Last active
October 28, 2024 15:06
-
-
Save dschaehi/4067ff5538786a8754e8fd631c72b711 to your computer and use it in GitHub Desktop.
A script for updating all conda-forge environments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env sh | |
| comment_box() { | |
| msg="$1" | |
| msg_length=${#msg} | |
| border_width=$((msg_length + 4)) # Padding for spaces around message | |
| # Generate the top and bottom border using the chosen comment character | |
| border=$(printf '%*s' "$border_width" '') # Create empty string of width | |
| border=$(echo "$border" | tr ' ' '#') # Replace spaces with '#' | |
| echo "$border" | |
| echo "# $msg #" | |
| echo "$border" | |
| } | |
| for var in $(conda env list --json | jq -r '.envs[] | select(contains("/miniforge3/")) | split("/")[-1]') | |
| do | |
| echo | |
| comment_box "Update conda environment \"$var\"" | |
| conda update -n $var --all -y -q | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment