I need to run a command that contains '<' in it.
I can run it from the command line, but it throws error when I put it into mvn exec.
The command:
c:\apps\putty\plink.exe myuser@myhost -T -ssh -2 $SHELL /dev/stdin 'a b c d' < test.sh
test.sh:
#!/bin/bash
echo "execution parameters: $@"
Command line output:
execution parameters: a b c d
pom.xml:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<id>test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration><executable>c:\apps\putty\plink.exe</executable>
<commandlineArgs>"myuser@myhost -T -ssh -2 $SHELL /dev/stdin 'a b c d' < test.sh"</commandlineArgs>
</configuration>
</execution>
</executions>
</plugin>
I tried to change '<' to '<', putting commandlineArgs into CDATA, put doubleqoutes (") everywhere but could not get this to work.
[DEBUG] Executing command line: [c:\apps\putty\plink.exe, > myuser@myhost -T -ssh -2 -pw tomcat $SHELL /dev/stdin 'a b c d' < test.sh]
Unable to open connection: Host does not exist[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
or:
[DEBUG] Executing command line: [c:\apps\putty\plink.exe, myuser@myhost, -T, -ssh, -2, -pw, tomcat, $SHELL /dev /stdin 'a b c d' < test.sh]
bash: test.sh: No such file or directory [INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
I'm suspecting the '<' parameter, but I'm not sure what is the real problem.
Any tips?
UPDATE: when I say "I tried to change '<' to '<', putting commandlineArgs into CDATA, put doubleqoutes (") everywhere but could not get this to work." - I mean it!