0

I run this

sudo mv /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/mysql.conf.d/mysqld.cnf.{,$(date +%Y%m%d%H%M%S)}

I get:

mv: target '/etc/mysql/mysql.conf.d/mysqld.cnf.20190517170628' is not a directory

running

sudo mv /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/mysql.conf.d/mysqld.cnf.222

does work though

any ideas?

1 Answer 1

1
 /etc/mysql/mysql.conf.d/mysqld.cnf.{,$(date +%Y%m%d%H%M%S)}

This expands to two files, so in total once brace expansion is performed you will have 3 command line parameters to the mv command. Verify that with echo instead of mv

When mv is invoked with 3 or more arguments it will treat all but last as files to be moved and the last item as destination directory where you want to move things. That is

mv file1 file2 directory

If your goal is to move only one specific file, the curly brace expansion can be left out and use only command substitution with date command

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .