From a6b58f4d9d5369533779b6a2f6044ca1f28fc9cb Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 8 Aug 2024 23:36:54 +0100 Subject: [PATCH] [recursive.sh]: add recursive.sh A script that calls itself --- README.md | 1 + recursive.sh | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100755 recursive.sh diff --git a/README.md b/README.md index dc4f88f..ab2f940 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,5 @@ This repository was created as a sister repository to the more practical [`utili repository to house scripts that were not useful enough to earn a place in there. ## Overview of Scripts + - `recursive.sh`: a script that calls itself - `suicidal_script.sh`: a script that deletes itself. diff --git a/recursive.sh b/recursive.sh new file mode 100755 index 0000000..2580835 --- /dev/null +++ b/recursive.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# A script that calls itself + +recursion_count=${1:-0} +echo "Recursion number $recursion_count" +$0 $((recursion_count + 1))