Minicom runscript does not understand variables
-
21-12-2019 - |
문제
I've been trying to execute a simple runsript that reads in a variable $1 and passes it out as serial data using the "send" command. I've had no issues sending text with that command in a script, but I dont want to write multiple scripts just to send different things. I'm not sure if I'm approaching this right. here's the code I thought it should be: (file is commands.sh)
#!bin/bash
send "$1\c"
when I run minicom -S commands.sh "flick servo" i get:
minicom: cannot open /dev/modem: No such file or directory
any ideas? I'm open to alternate ways to send text via terminal
해결책
The script is a minicom runscript, not a shell script. Naming the script .sh
or adding a comment saying !bin/bash
does not change this. -S
also doesn't accept arguments.
If (and only if) you can successfully run minicom -S hardcodedscript
, you can use environment variables to parameterize it:
Make a commands.rs
:
send "$(THING)\c"
then
THING='flick servo' minicom -S commands.rs