From 40357fedc890c31daf3fb48b7c0141fd4bbe0808 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Sat, 18 Sep 2021 21:53:14 +0200 Subject: [PATCH] bin: new helpers --- .local/bin/scripts/checkaccess | 9 +++++++++ .local/bin/scripts/chordpro-watch | 2 ++ .local/bin/scripts/kver | 6 ++++++ 3 files changed, 17 insertions(+) create mode 100755 .local/bin/scripts/checkaccess create mode 100755 .local/bin/scripts/chordpro-watch create mode 100755 .local/bin/scripts/kver diff --git a/.local/bin/scripts/checkaccess b/.local/bin/scripts/checkaccess new file mode 100755 index 0000000..6ca0092 --- /dev/null +++ b/.local/bin/scripts/checkaccess @@ -0,0 +1,9 @@ +#!/bin/sh +# Checks whether the current user has rights to the respective file, +# even if it does not exist. +# First parameter defines which rights are required and is passed to "test". +dir="$2" +while ! test -e "$dir" +do dir="$(dirname "$dir")" +done +test $1 "$dir" diff --git a/.local/bin/scripts/chordpro-watch b/.local/bin/scripts/chordpro-watch new file mode 100755 index 0000000..5ff7768 --- /dev/null +++ b/.local/bin/scripts/chordpro-watch @@ -0,0 +1,2 @@ +#!/bin/sh +ls *.cho | entr -c chordpro "$@" /_ diff --git a/.local/bin/scripts/kver b/.local/bin/scripts/kver new file mode 100755 index 0000000..a737f57 --- /dev/null +++ b/.local/bin/scripts/kver @@ -0,0 +1,6 @@ +#!/bin/sh +# Prints the latest Gradle and Kotlin versions +highlight "Kotlin" +curl https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/maven-metadata.xml 2>/dev/null | grep 'version>' | grep -iv '\(m\|rc\)' | sed 's/.*>\(.*\)<.*/\1/' | tail -6 +highlight "Gradle" +curl https://services.gradle.org/distributions/ 2>/dev/null | grep 'name.*all.*sha' | grep -v rc | head -6 | cut -d- -f2