Meaning of a code line

1 view (last 30 days)
Ricardo Duarte
Ricardo Duarte on 6 Dec 2021
Commented: Ricardo Duarte on 6 Dec 2021
Dear all,
I have an old piece of code that I'm trying to understand.
The line that is confusing me is:
eval( [ '!copy ' filename '.env + ..\HST_K_tail.env > foo.prt|' ] );
I understand the "eval" function but I don't understand the "+" signal and the following text.
Is anybody here that can translante it for me please.
Thank you all in advance.

Accepted Answer

Walter Roberson
Walter Roberson on 6 Dec 2021
Edited: Walter Roberson on 6 Dec 2021
! is going to invoke an operating system command. The operating system copy command will be invoked.
We can tell by the ..\ that the target is MS Windows. So this is the DOS copy command.
The DOS copy command allows you to specify multiple source files separated by + and all of those are to be combined in order.
In short, the command is adding a footer on to the end of the original file and storing the result into a particular file. I am not on the significance of the final | as I do not use Windows shell much.
  1 Comment
Ricardo Duarte
Ricardo Duarte on 6 Dec 2021
Thank you Walter!

Sign in to comment.

More Answers (0)


Find more on Loops and Conditional Statements in Help Center and File Exchange



Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!