linux - Disable pagination on the command line -
i trying write script using python module pexpect
connect server , execute commands typing @ command line.
so example, can have like:
child = pexpect.spawn('/usr/bin/ssh user@example.com')
child.sendline('ls -al')
or whatever command want send. act typing in terminal.
in script, trying run command using sendline()
api dumps out bunch of info command line. there pagination requires there command have press key continue next command.
so example:
[some info]
--------------- continue, press key. quit, press 'q'. ---------------
[some more info]
is there way can turn pagination off or command can send before try dump info command line turn off?
in linux: can use redirection skip pager(more
or less
). if important display output on screen, output can redirected tee
.
for example in man ls; ls
, man
command expects user press q
termination , ls
executed. execute both commands simultaneously without user intervention, can done man ls | tee; ls
. if displaying output not mandatory, can redirected /dev/null
well.
for additional help, please specify exact command trying execute on remote server.
in python: when using pexpect
, user activity can automated if intermediate output known in advance. can use expect
function wait particular output , take necessary action(for example using sendline
).
Comments
Post a Comment