Bash type & ctrl-z keypress

I have a command for minicom, send SMS via modem with SSH / Putty, here is the command

AT^HCMGS="destination number"<press ENTER>
> SMS message <press CTRL + Z>

      

The command runs successfully with minicom

I want to ask how to simulate pressing ENTER and CTRL + Z in bash Can I write a script like this?

#!/bin/bash
echo -e -n "AT^HCMGS="888"(I don't know how to insert enter/return)" > /dev/ttyUSB0
echo -e -n "SMS message (I don't know how to insert ctrl+z)" > /dev/ttyUSB0

      

I want to integrate a program (motion linux) with this script in openWRT

Thank!

+3


source to share


2 answers


To send a message to the number +48333444555 from the shell:

echo -e 'AT+CMGS="+48333444555"^Mtest^Z' > /dev/ttyUSB0

      



Attention!

  • to get ^ M you need to press Ctrl + V and then Ctrl + M
  • to get ^ Z you need to press Ctrl + V and then Ctrl + Z
+2


source


$ man skill

:

SYNOPSIS
        skill [signal] [options] expression

PROCESS SELECTION OPTIONS

   -t, --tty tty
          The next expression is a terminal (tty or pty).

EXAMPLES

        skill -KILL -t /dev/pts/*
            Kill users on PTY devices.

      



So it should be something like (can't verify): skill -STOP --tty /dev/ttyUSB0

0


source







All Articles