I have to write a script that outputs some paths to a file. Given a number that sets the max numbers of * characters (4 for instance here), my file should be something like this in the end :
/my/path/*/*.log
/my/path/*/*/*.log
/my/path/*/*/*/*.log
/my/path/*/*/*/*/*.log
I've looked for pyramid patterns to draw with bash, but can't figure out my case as there is a path before the * character ...
I've tried the following :
for ((i=1; i<= max_stars; i++))
do
echo -n "/my/path >> myfile.conf
for ((j=1; j<=i; j++))
do
echo -n "/*" >> myfile.conf
done
done
Any ideas ?
*character", but that should be correctly handled (if your script is fixed); please include the actual output of running your script in the question./my/path/**/*.loginbashto replace all those individual patterns if you just enable theglobstarshell option?