title: How to create new file and choose its name automatically?
body: <p>I have made the following Bash script (I'm a beginner).</p>
  
  <p>It makes a new directory <code>programming</code> and a file in it called <code>main.cpp</code>, then opens it in <code>nano</code> to let us edit it. Once we save it, it compiles it, changes compiled file's name and executes it. After that it goes back to root directory.</p>
  
  <p>What I want is that everytime this script is executed, a new name is given to the file automatically,  e.g. if executed first time file would be <code>main.cpp</code>,
  when executed again, it should make a file called <code>main_1.cpp</code>, then <code>main_2.cpp</code> and so on...</p>
  
  <p>Can i use a <code>for</code> loop or <code>if</code>-<code>else</code> statement? </p>
  
  <p>Here's the script:</p>
  
  <pre><code>mkdir programming
  cd programming
  nano main.cpp
  g++ main.cpp
  mv a.out main_executable
  ./main_executable
  cd
  </code></pre>