shell script for scaling with N