Reputation: 9035
I'm trying to issue a command that requires a line break due to a formatting restriction.
I need to commit a file to a CVS repository, but the repository has a restriction that requires a message to be included in the following format.
Change #: <number>
Description: <description>
The command used to commit the file is:
cvs commit -m "Change #: <number>\nDescription: <description>" <filename>
However when I issue the command it doesn't seem to be properly recognizing the line break and it fails saying that I gave it an invalid Change # and no Description.
How can I make it recognize the new line without it trying to issue two separate commands?
Upvotes: 0
Views: 541
Reputation: 9035
I'm actually attempting to call this command from a Perl script and found an acceptable workaround. For some reason calling the command as a system
command seems to fail, but if you call it using backticks it works fine.
# Fails
system 'cvs commit -m "Change #: <number>\nDescription: <description>" <filename>'
# Works
my $output = `cvs commit -m "Change #: <number>\nDescription: <description>" <filename>`
Whats funny is this difference in handling "\n" between using system
commands and backticks doesn't seem to be documented anywhere.
Upvotes: 0
Reputation: 30152
Try powershell in this format:
start-process -FilePath cvs.exe -ArgumentList "commit -m `"Change #:123 `nDescription:my description`""
Upvotes: 1