Skip to content

Instantly share code, notes, and snippets.

@scottisloud
Last active August 29, 2023 23:59
Show Gist options
  • Select an option

  • Save scottisloud/f0016a29c2c404440c7731f21da1dbae to your computer and use it in GitHub Desktop.

Select an option

Save scottisloud/f0016a29c2c404440c7731f21da1dbae to your computer and use it in GitHub Desktop.
replace http with https for 1Password items
#!/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