Unexpected result using Run Command Line with more and grep

Document ID : KB000009272
Last Modified Date : 14/02/2018
Show Technical Document Details

While using the "Run Command Line" action to run: more /tmp/silent.varfile.aio | grep "adminRights" -n

It returns the following:



This is unexpected because if I run the same command from the command prompt it shows:


Release Automation: All VersionsRelease Automation Agent on Linux/Unix

The reason why this behavior is observed is because the more command is used to display output to the terminal one page at a time. However, the actions invoked by the agent are not run from a terminal (also know as tty). The more command seems to be introducing this unexpected value because it is not being run in a terminal. The same behavior can be seen if you add that command and its output to run as a cron job. Based on this using the more command is discouraged and should not be necessary. 


The desired output with the correct results could be achieved by running the command without more. Example: grep "adminRights" -n /tmp/silent.varfile.aio