More command has different output between Jenkins script and a script executed in shell without Jenkins


I have the script that contain “more toto.txt” command.

when the script is executed in a terminal on linux, the output of this script is the content of the file toto.txt

when the same script is executed on the same machine, same user but using jenkins, I have the following output for more


Why do I have kind of header during Jenkins execution and not in classic shell execution ?

I just saw this seems like the same problem I got in another behaviour.
I can “dotnet restore” with the System Authority User on a windows build agent => it works
The same command via jenkins script “powershell ‘dotnet restore’” is not resulting in the same…

I could’t figure it out yet…but you are not alone :slight_smile:

I displayed “which more” and the path is the same in both environnement. So I totally don’t understand why the behavior of the more command is not the same.

Have you tried the Jenkins Method yet: “readFile(filename)”
This should give you the same result working with Jenkins :slight_smile:

the problem is that I don’t want to use a specic jenkins Method. I have a .sh script that works well on linux and that I can execute when I want for debug purpose. And I want to execute the same script using jenkins each week so that I could have an alert if something is wrong.

it is the first time that a script don’t works the same on linux and on jenkins (using a slave on the same machine)

In my job, I have a line “./”

and is already executed correctly on the same machine.

More is a pager and probably has behavior that differs between an interactive shell or not. Plus I know it can have different behavior based on env variables

Both are pretty common answer to “why does this work differently locally vs in Jenkins”

Also why would you want to use more in a non interactive script? Cat seems like the better choice

1 Like

thanks a lot. yes this is the solution. I’m used to the “more” fonction but it is cleaner to use the cat one. I didn’t know more could display different output depending on the env variable or depending on the interactifve shell or not.