0

I am writing a bash script. Below is my command

screen -x stack -p n-api -X stuff "ls"

This command just pastes this command never executes. Hence i used

control + V + enter command 

to form a symbol

^M

which is essentially an enter. but whenever i open the script to edit some other pieces the command goes away and again i am not able to press enter in the screen session using bash script

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Shweta B. Patil
  • 1,131
  • 2
  • 11
  • 19

1 Answers1

0

From here, this seems to work for me:

screen -x stack -p n-api -X stuff "ls$(printf \\r)"

Other solutions that can be found in How to execute a command inside a screen session are

screen -x stack -p n-api -X stuff 'ls\n'

as well as your solution by inserting ^M with ctrl-V ctrl-L ctrl-V ctrl-M

Community
  • 1
  • 1
martin
  • 3,149
  • 1
  • 24
  • 35