Advanced Linux Shell Scripting
Day-5 Task:
To write a shell script that will create directories up to N number.
#!/bin/bash
if [ "$#" -ne 3 ]; then
echo "Please provide directory name, start number, and end number as arguments."
exit 1
fi
dir_name=$1
start_num=$2
end_num=$3
for (( i=start_num; i<=end_num; i++ )); do
dir="${dir_name}${i}"
mkdir "$dir"
done
To execute the task, we will write the command - ./createDirectories.sh dir 1 5