title: How to break the string in shell script
body: <p>I have the databases name in following format</p>
  
  <pre><code>username_databasename
  </code></pre>
  
  <p>Now I want to put separate database backups in username directory like</p>
  
  <pre><code>/backups/username/backup
  </code></pre>
  
  <p>How can I get the usernamae from that string</p>
  
  <p>I also want that if string does not contain underscore (_) then the backup should go to</p>
  
  <pre><code>/backups/others/backup
  </code></pre>