If one executes the following two commands in one line as follows,
rm -rf dir ; cp -r dir2 dir
it may return that cp can not create directory
dir/subdir: File exists
but if these two commands are executed in two lines, no errors will be thrown. I am just wondering what is the difference and more importantly, how to execute two commands in one line, with the effect exactly the same as by two lines...
EDIT: I change it to
cp -r dir2 dir. Besides, what is in
dir2 is huge, typically 4gb.