Pesky BASH script bugbash if statement behaviour questionBash script question - skip enter key pressbash...
Does jamais mean always or never in this context?
If Earth is tilted, why is Polaris always above the same spot?
Has any spacecraft ever had the ability to directly communicate with civilian air traffic control?
How can I get precisely a certain cubic cm by changing the following factors?
Feels like I am getting dragged in office politics
Is creating your own "experiment" considered cheating during a physics exam?
How to set the font color of quantity objects (Version 11.3 vs version 12)?
Why do Ichisongas hate elephants and hippos?
How to replace the "space symbol" (squat-u) in listings?
Sci-fi novel series with instant travel between planets through gates. A river runs through the gates
Phrase for the opposite of "foolproof"
Past Perfect Tense
Colliding particles and Activation energy
Did Henry V’s archers at Agincourt fight with no pants / breeches on because of dysentery?
Was it really necessary for the Lunar Module to have 2 stages?
What does YCWCYODFTRFDTY mean?
Transfer over $10k
Advice on laptop battery life
How to stop co-workers from teasing me because I know Russian?
A question regarding using the definite article
Lock in SQL Server and Oracle
Where did the extra Pym particles come from in Endgame?
Does a creature that is immune to a condition still make a saving throw?
Upright [...] in italics quotation
Pesky BASH script bug
bash if statement behaviour questionBash script question - skip enter key pressbash script programming questionWhat is wrong with my init.d script [Segmentation fault]shell script with interesting bugPassword generator question bash scriptQuestion in bash scriptbash pattern questionShell script questionquick bash question
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I am using the following short BASH script running on a Raspberry PI 3B to monitor port 11005 for 1 and 0 strings on a PC within my network - it toggles a GPIO output to key an amateur radio morse code transmitter. After displaying "Start listening on Port 11005, I get the error message
morse2.sh 36: morse2.sh: Syntax error: "(" unexpected.
I have tried a bunch of fixes - none work. Also, why does this script need nmap to run? I have nmap installed on the Raspberry pi - seems to run well.
#!/bin/bash
#be sure you have already installed nmap on your PI
PORT=11005
CW_PIN=25
echo "Start listening on port $PORT ..."
while read line
do
#echo $line
#echo $line | od -An -t uC
cmd=${line:0:1}
#echo $cmd
#echo $cmd | od -An -t uC
case "$cmd" in
0) #echo "000"
gpio write $CW_PIN 0
;;
1) #echo "111"
gpio write $CW_PIN 1
;;
3) echo "Going to stop listener ..."
break
;;
*) #echo "unknown cmd"
;;
esac
done < <((echo "Welcome. Please give me one of the following commands: 0 | 1 | 3") | ncat -k -l $PORT)
echo "... listener stopped."
exit 0
bash shell-script
New contributor
SteveW is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I am using the following short BASH script running on a Raspberry PI 3B to monitor port 11005 for 1 and 0 strings on a PC within my network - it toggles a GPIO output to key an amateur radio morse code transmitter. After displaying "Start listening on Port 11005, I get the error message
morse2.sh 36: morse2.sh: Syntax error: "(" unexpected.
I have tried a bunch of fixes - none work. Also, why does this script need nmap to run? I have nmap installed on the Raspberry pi - seems to run well.
#!/bin/bash
#be sure you have already installed nmap on your PI
PORT=11005
CW_PIN=25
echo "Start listening on port $PORT ..."
while read line
do
#echo $line
#echo $line | od -An -t uC
cmd=${line:0:1}
#echo $cmd
#echo $cmd | od -An -t uC
case "$cmd" in
0) #echo "000"
gpio write $CW_PIN 0
;;
1) #echo "111"
gpio write $CW_PIN 1
;;
3) echo "Going to stop listener ..."
break
;;
*) #echo "unknown cmd"
;;
esac
done < <((echo "Welcome. Please give me one of the following commands: 0 | 1 | 3") | ncat -k -l $PORT)
echo "... listener stopped."
exit 0
bash shell-script
New contributor
SteveW is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Where do I begin? (1) Does it actually say “morse2.sh” twice in the error message? (2) Have you posted the complete script (i.e., the one that got that error message)? (3) When you edit the script, which one is line 36? (4) “Also, why does this script need nmap to run?” Because it usesnmap. Or is your question something more subtle than that?
– Scott
1 hour ago
add a comment |
I am using the following short BASH script running on a Raspberry PI 3B to monitor port 11005 for 1 and 0 strings on a PC within my network - it toggles a GPIO output to key an amateur radio morse code transmitter. After displaying "Start listening on Port 11005, I get the error message
morse2.sh 36: morse2.sh: Syntax error: "(" unexpected.
I have tried a bunch of fixes - none work. Also, why does this script need nmap to run? I have nmap installed on the Raspberry pi - seems to run well.
#!/bin/bash
#be sure you have already installed nmap on your PI
PORT=11005
CW_PIN=25
echo "Start listening on port $PORT ..."
while read line
do
#echo $line
#echo $line | od -An -t uC
cmd=${line:0:1}
#echo $cmd
#echo $cmd | od -An -t uC
case "$cmd" in
0) #echo "000"
gpio write $CW_PIN 0
;;
1) #echo "111"
gpio write $CW_PIN 1
;;
3) echo "Going to stop listener ..."
break
;;
*) #echo "unknown cmd"
;;
esac
done < <((echo "Welcome. Please give me one of the following commands: 0 | 1 | 3") | ncat -k -l $PORT)
echo "... listener stopped."
exit 0
bash shell-script
New contributor
SteveW is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I am using the following short BASH script running on a Raspberry PI 3B to monitor port 11005 for 1 and 0 strings on a PC within my network - it toggles a GPIO output to key an amateur radio morse code transmitter. After displaying "Start listening on Port 11005, I get the error message
morse2.sh 36: morse2.sh: Syntax error: "(" unexpected.
I have tried a bunch of fixes - none work. Also, why does this script need nmap to run? I have nmap installed on the Raspberry pi - seems to run well.
#!/bin/bash
#be sure you have already installed nmap on your PI
PORT=11005
CW_PIN=25
echo "Start listening on port $PORT ..."
while read line
do
#echo $line
#echo $line | od -An -t uC
cmd=${line:0:1}
#echo $cmd
#echo $cmd | od -An -t uC
case "$cmd" in
0) #echo "000"
gpio write $CW_PIN 0
;;
1) #echo "111"
gpio write $CW_PIN 1
;;
3) echo "Going to stop listener ..."
break
;;
*) #echo "unknown cmd"
;;
esac
done < <((echo "Welcome. Please give me one of the following commands: 0 | 1 | 3") | ncat -k -l $PORT)
echo "... listener stopped."
exit 0
bash shell-script
bash shell-script
New contributor
SteveW is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
SteveW is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 13 mins ago
αғsнιη
17.8k103271
17.8k103271
New contributor
SteveW is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 1 hour ago
SteveWSteveW
11
11
New contributor
SteveW is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
SteveW is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
SteveW is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Where do I begin? (1) Does it actually say “morse2.sh” twice in the error message? (2) Have you posted the complete script (i.e., the one that got that error message)? (3) When you edit the script, which one is line 36? (4) “Also, why does this script need nmap to run?” Because it usesnmap. Or is your question something more subtle than that?
– Scott
1 hour ago
add a comment |
Where do I begin? (1) Does it actually say “morse2.sh” twice in the error message? (2) Have you posted the complete script (i.e., the one that got that error message)? (3) When you edit the script, which one is line 36? (4) “Also, why does this script need nmap to run?” Because it usesnmap. Or is your question something more subtle than that?
– Scott
1 hour ago
Where do I begin? (1) Does it actually say “
morse2.sh” twice in the error message? (2) Have you posted the complete script (i.e., the one that got that error message)? (3) When you edit the script, which one is line 36? (4) “Also, why does this script need nmap to run?” Because it uses nmap. Or is your question something more subtle than that?– Scott
1 hour ago
Where do I begin? (1) Does it actually say “
morse2.sh” twice in the error message? (2) Have you posted the complete script (i.e., the one that got that error message)? (3) When you edit the script, which one is line 36? (4) “Also, why does this script need nmap to run?” Because it uses nmap. Or is your question something more subtle than that?– Scott
1 hour ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
SteveW is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f516073%2fpesky-bash-script-bug%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
SteveW is a new contributor. Be nice, and check out our Code of Conduct.
SteveW is a new contributor. Be nice, and check out our Code of Conduct.
SteveW is a new contributor. Be nice, and check out our Code of Conduct.
SteveW is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f516073%2fpesky-bash-script-bug%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Where do I begin? (1) Does it actually say “
morse2.sh” twice in the error message? (2) Have you posted the complete script (i.e., the one that got that error message)? (3) When you edit the script, which one is line 36? (4) “Also, why does this script need nmap to run?” Because it usesnmap. Or is your question something more subtle than that?– Scott
1 hour ago