title: how to append directory name and date as backup file suffix?
body: <p>I need to make a script to backup of files, and I would like to have a timestamp and base file name as part of the name to make it easier to differentiate.</p>
  
  <pre><code>#!/bin/bash
  filename=$(basename $(pwd))
  echo $filename
  
  output_dir="/home/backup/backup_$filename_$(date +%Y-%m-%d_%Hh%Mm%Ssec)/"
  echo $output_dir
  </code></pre>
  
  <p><strong>Getting following output :-</strong></p>
  
  <pre><code>bash-4.2$ ./backup_1.sh
  test
  /home/backup/backup_2018-08-21_10h44m10sec/
  bash-4.2$
  </code></pre>
  
  <p>In output_dir name filename "<strong>test</strong>" not included only timestamp added as suffix. Expected output is "<strong>/home/backup/backup_test_2018-08-21_10h44m10sec/</strong>"</p>
  
  <p>Any suggestions are greatly appreciated. </p>