Bash WP-CLI - Sort site list alphabetically

sites=$(wp site list --field=url); readarray -t sorted < <(for a in "${sites[@]}"; do echo "$a"; done | sort); for a in "${sorted[@]}"; do echo "$a"; done

1 Response

wp site list --field=url | sort

also works

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.