From 57ef06336c5c10bb85111bc5b907dae878c43485 Mon Sep 17 00:00:00 2001 From: Jorrit Wegman Date: Sat, 9 Oct 2021 12:50:10 -0300 Subject: [PATCH] Add --all flag to execute all colorscripts --- shell-color-scripts/colorscript.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/shell-color-scripts/colorscript.sh b/shell-color-scripts/colorscript.sh index 2091534..dfa611c 100755 --- a/shell-color-scripts/colorscript.sh +++ b/shell-color-scripts/colorscript.sh @@ -12,7 +12,8 @@ _help() { "-h, --help, help" "Print this help." \ "-l, --list, list" "List all installed color scripts." \ "-r, --random, random" "Run a random color script." \ - "-e, --exec, exec" "Run a specified color script by SCRIPT NAME or INDEX." + "-e, --exec, exec" "Run a specified color script by SCRIPT NAME or INDEX."\ + "-a, --all, all" "List the outputs of all colorscripts with their SCRIPT NAME" } _list() { @@ -66,6 +67,15 @@ _run_colorscript() { fi } +function _run_all() { + for s in $DIR_COLORSCRIPTS/* + do + echo "$(echo $s | awk -F '/' '{print $NF}'):" + echo "$($s)" + echo + done +} + case "$#" in 0) _help @@ -81,6 +91,9 @@ case "$#" in -r | --random | random) _random ;; + -a | --all | all) + _run_all + ;; *) echo "Input error." exit 1