Skip to content
Snippets Groups Projects

YQ Basic Install

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Paul Gierz

    Installs the yq command line utility for easily parsing YAML files.

    Edited
    install_4p27p2_yq.sh 653 B
    #!/bin/bash -e
    VERSION=v4.27.2
    BINARY=yq_linux_386
    if [ ! -d ${HOME}/.local/bin ]; then
    	mkdir -p ${HOME}/.local/bin
    fi
    wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY}.tar.gz -O - |\
    	  tar xz && mv ${BINARY} ${HOME}/.local/bin/yq
    
    my_path="$(command -v yq)"
    
    if [ -z "$my_path" ]; then
      echo "'yq' wasn't found in your PATH, so we don't know where to put the man pages."
      echo "Please update your PATH to include yq, and run this script again."
      exit 1
    fi
    
    # ex: ~/.local/bin/yq => ~/.local/
    my_prefix="$(dirname "$(dirname "$(command -v yq)")")"
    mkdir -p "$my_prefix/share/man/man1/"
    mv yq.1 "$my_prefix/share/man/man1/"
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment