copy - Bash how can rename a file saved into a variable? -
How can I do this:
I have a file, I I found this solution: The easiest way to do it: 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
$ filetosend < / Code> How can I change the name
DATE = (date +% Y% M% d) mydir = $ (echo $ (dirname) $ A)) myfile = $ (counterclocker $ (basename $ a)) myfile = $ {DATE} _ $ {myfile} filetosend = $ mydir / $ myfile cp $ a $ Filetosend
mv /home/cft/eval.txt / home / Cft / $ ( Date "+% Y% m% d") _ eval.txt
Comments
Post a Comment