Last active
August 29, 2023 23:59
-
-
Save scottisloud/f0016a29c2c404440c7731f21da1dbae to your computer and use it in GitHub Desktop.
replace http with https for 1Password items
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 bash | |
| ######################################################### | |
| # REPLACE HTTP WITH HTTPS | |
| ######################################################### | |
| # This script replaces or adds the value of the website field for all items in a specified vault | |
| # Provide a vault UUID or vault name | |
| vaultUUID="" | |
| # convert http to https for each login item in specified vault | |
| for item in $(op item list --vault $vaultUUID --categories Login --format json | jq --raw-output '.[].id') | |
| do | |
| oldURL=$(op item get $item --format=json | jq --raw-output '.urls[].href') | |
| newURL=$(echo $oldURL | sed 's/^http:\/\//https:\/\//g') | |
| op item edit $item website=$newURL | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment