Skip to content

Instantly share code, notes, and snippets.

@TekWizely
TekWizely / alternatives_parse_query.bash
Created October 29, 2021 23:36
Bash script to parse the output of 'update-alternatives --query'
# shellcheck shell=bash
#######################################################################
# SPDX-License-Identifier: MIT
# Copyright (c) 2021 TekWizely & co-authors
#
# Use of this source code is governed by the MIT license.
# See the accompanying LICENSE file, if present, or visit:
# https://opensource.org/licenses/MIT
#######################################################################
# VERSION="v1.0.0"
@TekWizely
TekWizely / serialize_array.bash
Last active August 4, 2022 17:02
Script to Serialize / Deserialize a Bash Array to/from a String - Requires knowing one character NOT present in the array, to be used as the separator.
# shellcheck shell=bash
##
# serialize_array
# Serializes a bash array to a string, with a configurable seperator.
#
# $1 = source varname ( contains array to be serialized )
# $2 = target varname ( will contian the serialized string )
# $3 = seperator ( optional, defaults to $'\x01' )
#