Added stdin check to hello world script
This commit is contained in:
@@ -1,4 +1,15 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
echo "Hello world!"
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user