Search Term For Date Command To Remove Dashes In Output

Hello, working on my 2nd ever script and after multiple tests have it working. Initially A was 1st but would have to Search/Replace to change output folder. B solved it for me with use of mv command, but wanted method to change date on output folder. Initially started to look into variables but would still have to manually change it. Watching TV thought of date and after numerous trials it worked in C. Only small thing I am trying to find the correct search term to go about removing the - in the date in the output folder. Shown in image on right. Have tried various things on the script.
Also yes I could put all paths in one line but more readable for me. Have all folders in script with not wanted in bu commented out. (not shown)

Change the - to (space).

(date +"%d %b %Y")

Hi, I had tried that before but tried again. Maybe I'm using wrong code?
Here is command from terminal I used:
mkdir "a b c"-$(date +"%d %b %Y")

Image shows folders created:

Try this:

mkdir "a b c-$(date +"%d %b %Y")"

Move the double quote outside.

2 Likes

Thanks just had to also remove the - before the $ to eliminate the final dash.
Thinking about it moving the quote makes sense as the date is part of the new folder name. Thought the dash was needed. Learned something.

Tested with new command using desired name and works great.
mkdir "Ubuntu Mate Configuration $(date +"%d %b %Y")"

Yes. I learned some things also.

There should be a new type of topic named BASH Puzzles. Similar to crossword puzzles or sudoku. Open up a terminal to play.