Page 1 of 1

can not get an ls /directory/subdir | tail -1 to execute

Posted: Fri May 29, 2015 10:44 am
by paulschiele
In Director version 4.6.1 I can't seem to get the right syntax to execute a the below native command in Linux. I have tried several different ways of splitting this up into varialbes in seperate arguments etc. etc. to no avail.

ls /directory/subdir | tail -1

config is as follows:
arg: /directory/subdir | tail -1

Returns this error:
5/29/15 11:23:40 AM INFO Preparing to execute the native command 'ls' with the argument(s) '/directory/subdir/inbound | tail -1'
5/29/15 11:23:40 AM INFO ls: cannot access /directory/subdir/inbound | tail -1: No such file or directory
5/29/15 11:23:41 AM INFO The native command 'ls' finished with a return code of '2'
5/29/15 11:23:41 AM ERROR [9003 - exec] The executable encountered an error with a return code of '2'. To ignore this error, set the attribute 'errorIfExecutableFails' to false.


Re: can not get an ls /directory/subdir | tail -1 to execute

Posted: Tue Jun 02, 2015 5:15 pm
by Support_Rick
While GoAnywhere Director provides a way to execute a native command on the local system, “piping” in a command string in Linux is not supported. This pipe “|” function is actually two commands, the result of the first serves as the input for the second. In technical terms, these are two threads. To accomplish the same result, the first command (before the “|”) can be executed with the Execute Native Command task, then the results used in a second Execute Native Command task.