Warning: Specifying a channel "Latest/Edge" is relying on undefined behaviour. Interpreting it as
"Latest/Edge" for now, but this will be an error later.
error: invalid risk in channel name: Latest/Edge
NativeCommandExitException: Program "snap" ended with non-zero exit code: 1.
The change I’ve made to the Select-String pattern guarantees that it’ll find the first word in each line and will skip the header row by ignoring 'Name ' at the start of the row. (This should be fine since snap names aren’t allowed to have spaces and are all lower-case). ForEach-Object now outputs just the matching portion of the line rather than the full text.
You could also query the snapd REST API directly, but I’m not sure whether Powershell can be coaxed to make Invoke-RestMethod talk to a unix-domain socket rather than a TCP one.
Does the 1st example deliberately contain latest-edge rather than latest/edge? snap appears to accept it, but I had not heard of the channel previously, and the output causes me to believe that it merely reverts to stable because the channel name is potentially invalid. Please advise. Thanks.
PS /home/BEEDELLROKEJULIANLOCKHART> snap list | Select-String -Pattern "^(?!Name )\S+" -CaseSensitive | ForEach-Object { snap switch $_.Matches[0].Value --channel latest-edge }
"authy" switched to the "latest-edge/stable" channel
"bare" switched to the "latest-edge/stable" channel
"core18" switched to the "latest-edge/stable" channel
"core20" switched to the "latest-edge/stable" channel
"gnome-3-28-1804" switched to the "latest-edge/stable" channel
"gnome-3-38-2004" switched to the "latest-edge/stable" channel
"gtk-common-themes" switched to the "latest-edge/stable" channel
"raindrop" switched to the "latest-edge/stable" channel
"snapd" switched to the "latest-edge/stable" channel
"spotify" switched to the "latest-edge/stable" channel
"spotify-qt" switched to the "latest-edge/stable" channel
PS $Home> snap list
Name Version Rev Tracking Publisher Notes
authy 2.2.2 12 latest-edge/stable twilio-authy -
bare 1.0 5 latest-edge/stable canonicalâś“ base
core18 20221212 2667 latest-edge/stable canonicalâś“ base
core20 20221216 1796 latest-edge/stable canonicalâś“ base
gnome-3-28-1804 3.28.0-19-g98f9e67.98f9e67 185 latest-edge/stable canonicalâś“ -
gnome-3-38-2004 0+git.6ed44b3 105 latest-edge/stable canonicalâś“ -
gtk-common-themes 0.1-81-g442e511 1535 latest-edge/stable canonicalâś“ -
raindrop 5.5.10 6 latest-edge/stable exentrich -
snapd 2.58+git294.g5caf673 18146 latest-edge/stable canonicalâś“ snapd
spotify 1.1.84.716.gc5f8b819 60 latest-edge/stable spotifyâś“ -
spotify-qt v3.9 2228 latest-edge/stable kraxarn -
PS $Home> snap list | Select-String -Pattern "^(?!Name )\S+" -CaseSensitive | ForEach-Object { snap switch $_.Matches[0].Value --channel latest/edge }
"authy" switched to the "latest/edge" channel
"bare" switched to the "latest/edge" channel
"core18" switched to the "latest/edge" channel
"core20" switched to the "latest/edge" channel
"gnome-3-28-1804" switched to the "latest/edge" channel
"gnome-3-38-2004" switched to the "latest/edge" channel
"gtk-common-themes" switched to the "latest/edge" channel
"raindrop" switched to the "latest/edge" channel
"snapd" switched to the "latest/edge" channel
"spotify" switched to the "latest/edge" channel
"spotify-qt" switched to the "latest/edge" channel
PS $Home> snap list
Name Version Rev Tracking Publisher Notes
authy 2.2.2 12 latest/edge twilio-authy -
bare 1.0 5 latest/edge canonicalâś“ base
core18 20221212 2667 latest/edge canonicalâś“ base
core20 20221216 1796 latest/edge canonicalâś“ base
gnome-3-28-1804 3.28.0-19-g98f9e67.98f9e67 185 latest/edge canonicalâś“ -
gnome-3-38-2004 0+git.6ed44b3 105 latest/edge canonicalâś“ -
gtk-common-themes 0.1-81-g442e511 1535 latest/edge canonicalâś“ -
raindrop 5.5.10 6 latest/edge exentrich -
snapd 2.58+git294.g5caf673 18146 latest/edge canonicalâś“ snapd
spotify 1.1.84.716.gc5f8b819 60 latest/edge spotifyâś“ -
spotify-qt v3.9 2228 latest/edge kraxarn -
PS $Home>