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

**URL:** https://community.jenkins.io/t/more-command-has-different-output-between-jenkins-script-and-a-script-executed-in-shell-without-jenkins/3628
**Category:** Ask a question
**Created:** [September 5, 2022, 8:53am UTC](https://community.jenkins.io/t/more-command-has-different-output-between-jenkins-script-and-a-script-executed-in-shell-without-jenkins/3628 "2022-09-05T08:53:23Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![iostrym](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/iostrym/32/1343_2.png) [@iostrym](https://community.jenkins.io/u/iostrym)
#### Post date: [September 5, 2022, 8:53am UTC](https://community.jenkins.io/t/more-command-has-different-output-between-jenkins-script-and-a-script-executed-in-shell-without-jenkins/3628/1 "2022-09-05T08:53:23Z")

</div>

Hello,

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

::::::::::::::  
toto.txt  
::::::::::::::

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

---

<div class="post-metadata">

### Author: ![Proxyboy](https://avatars.discourse-cdn.com/v4/letter/p/e19b73/32.png) [@Proxyboy](https://community.jenkins.io/u/Proxyboy)
#### Post date: [September 5, 2022, 11:01am UTC](https://community.jenkins.io/t/more-command-has-different-output-between-jenkins-script-and-a-script-executed-in-shell-without-jenkins/3628/2 "2022-09-05T11:01:19Z")

</div>

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 🙂

---

<div class="post-metadata">

### Author: ![iostrym](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/iostrym/32/1343_2.png) [@iostrym](https://community.jenkins.io/u/iostrym)
#### Post date: [September 5, 2022, 11:53am UTC](https://community.jenkins.io/t/more-command-has-different-output-between-jenkins-script-and-a-script-executed-in-shell-without-jenkins/3628/3 "2022-09-05T11:53:22Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Proxyboy](https://avatars.discourse-cdn.com/v4/letter/p/e19b73/32.png) [@Proxyboy](https://community.jenkins.io/u/Proxyboy)
#### Post date: [September 5, 2022, 12:03pm UTC](https://community.jenkins.io/t/more-command-has-different-output-between-jenkins-script-and-a-script-executed-in-shell-without-jenkins/3628/4 "2022-09-05T12:03:30Z")

</div>

> [@iostrym](#):
>
> more

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

---

<div class="post-metadata">

### Author: ![iostrym](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/iostrym/32/1343_2.png) [@iostrym](https://community.jenkins.io/u/iostrym)
#### Post date: [September 5, 2022, 1:55pm UTC](https://community.jenkins.io/t/more-command-has-different-output-between-jenkins-script-and-a-script-executed-in-shell-without-jenkins/3628/5 "2022-09-05T13:55:01Z")

</div>

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 “./script.sh”

and script.sh is already executed correctly on the same machine.

---

<div class="post-metadata">

### Author: ![halkeye](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/halkeye/32/8_2.png) [@halkeye](https://community.jenkins.io/u/halkeye)
#### Post date: [September 5, 2022, 3:44pm UTC](https://community.jenkins.io/t/more-command-has-different-output-between-jenkins-script-and-a-script-executed-in-shell-without-jenkins/3628/6 "2022-09-05T15:44:26Z")

</div>

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

---

<div class="post-metadata">

### Author: ![iostrym](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/iostrym/32/1343_2.png) [@iostrym](https://community.jenkins.io/u/iostrym)
#### Post date: [September 6, 2022, 2:49pm UTC](https://community.jenkins.io/t/more-command-has-different-output-between-jenkins-script-and-a-script-executed-in-shell-without-jenkins/3628/7 "2022-09-06T14:49:59Z")

</div>

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.
