#!/bin/bash

for index in $(seq 1 99); do
    name="stack$index"
    next=$((index + 1))
    mkdir $name
    echo "print('import stack $index')" > $name/__init__.py
    echo "import os; os.system('cat /proc/%s/maps|grep stack' % os.getpid())" > $name/__init__.py
    echo "import stack$next" >> $name/__init__.py
done

index=100
name="stack$index"
mkdir $name
echo "print('HELLO')" > $name/__init__.py

ulimit -s 128
python -m stack1

rm -rf stack*
