From 30d1f61ed1bb20f567460ba2c92da799f54e3368 Mon Sep 17 00:00:00 2001 From: Random936 Date: Tue, 30 Sep 2025 21:34:33 -0700 Subject: [PATCH] Added stdin check to hello world script --- hello/world.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hello/world.sh b/hello/world.sh index 8bbf55f..9884602 100644 --- a/hello/world.sh +++ b/hello/world.sh @@ -1,4 +1,15 @@ #!/usr/bin/env bash echo "Hello world!" -echo "Remaining arguments: $@" + +if [ $# -gt 0 ]; then + echo "Got CLI arguments:" + for ((i = 1; i <= $#; ++i)); do + echo "$i: ${!i}" + done +fi + +if read -t 0 _; then + echo "Recieved stdin:" + cat +fi