Why this methodolgy?


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Why this methodolgy?
# 1  
Old 12-15-2018
Why this methodolgy?

Hi Folks -


I have a quick question. A colleaguge has placed this in a shell script:


Code:
    mv "*.txt" "${_FCST_EXPORT_PATH}/temp/EPBCS_Forecast_${_DATETIMESTAMP}.txt"
    mv "${_FCST_EXPORT_PATH}/temp/*.txt" "${_FCST_EXPORT_PATH}"


What is the purpose of this? If I understand it correctly, the temp directory is unnecessary and he's using it to just append datetimestamp and can be done in one line.



Thanks.
# 2  
Old 12-15-2018
Code:
"*.txt"
".../temp/*.txt"

This is not globbing, these are strings. The files must exist with such names.
# 3  
Old 12-15-2018
And, SHOULD the * be expanded - e.g. by moving it before the quotes - to multiple file names, they all would end up in one single file, the last one overwriting all predecessors that might have been moved before, and all of those would be lost...

Last edited by RudiC; 12-15-2018 at 03:28 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question