copy - Bash how can rename a file saved into a variable? -


How can I do this:

I have a file, eval.txt has been saved in a variable, which I call timestamp_evale. Txt

  filetosend = / home / cft / eval.txt file name = $ (echo $ filetosend | cut-d '/' -f4) // only to get the name Add a timestamp for the name of $ = $ (date +% Y% m% d) filename = $ {DATE} _ $ {filename} // name   

I $ filetosend < / Code> How can I change the name

I found this solution:

  DATE = (date +% Y% M% d) mydir = $ (echo $ (dirname) $ A)) myfile = $ (counterclocker $ (basename $ a)) myfile = $ {DATE} _ $ {myfile} filetosend = $ mydir / $ myfile cp $ a $ Filetosend    

The easiest way to do it:

  mv /home/cft/eval.txt / home / Cft / $ ( Date "+% Y% m% d") _ eval.txt    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -