0

How do I clear the terminal and show the output of my script after a blank terminal.

This is the top of my script:

#!/usr/bin/env php <?php require_once("setting/phpmailer/PHPMailerAutoload.php"); include('setting/mks.settings.php');

its the different question from my last, my last question is how to make my tag working, but in this question im asking how to make bash command clear working on my php bash @mario, thx The way I run this script as the bash script ./myfile

I want to make like the clear command on bash, but I don't know how to do so, when I put clear it just print out clear without clearing the terminal.

7
  • 1
    This may sound silly, but have you tried executing the command (exec('clear');)? Commented Mar 3, 2019 at 21:22
  • i have tried adding it on my php bash script, it just print out (exec('clear');) EDIT : have tried it, doesnt work, just came usually but not cleared Commented Mar 3, 2019 at 21:30
  • 1
    Not reproducible from the sample code provided. Commented Mar 3, 2019 at 21:33
  • 2
    Just ran a test and exec('clear'); does not work. However, this following taken from @mario's duplicate does work on my machine: echo "\033[2J\033[1;1H"; Commented Mar 3, 2019 at 21:40
  • @rickdenhaan I think clear would also work. But it might need something like passthru("clear -T xterm 2>&1"); because it also just returns the ANSI sequence instead of manipulating the terminal directly. Commented Mar 3, 2019 at 21:47

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.