- Posts: 1004
- Thank you received: 449
Bash M1## how to use the P word
- my1987toyota
- Offline
- Platinum Member
-
Less
More
5 years 1 month ago #220578
by my1987toyota
Replied by my1987toyota on topic Bash M1## how to use the P word
terminal responds
1.000000
I am unfortunately still very much a noob. Not just on Linuxcnc but also to Linux in general.
How did you make the upside down double quotes or ". I couldn't duplicate that.
1.000000
I am unfortunately still very much a noob. Not just on Linuxcnc but also to Linux in general.
How did you make the upside down double quotes or ". I couldn't duplicate that.
Please Log in or Create an account to join the conversation.
- Aciera
- Offline
- Administrator
-
Less
More
- Posts: 4819
- Thank you received: 2177
5 years 1 month ago - 5 years 1 month ago #220580
by Aciera
Replied by Aciera on topic Bash M1## how to use the P word
I believe the quotes depend on the location setting.
It should work with either ' ' or " " quotes.
[edit]
To get rid of all the zeros you could try:
echo ${1%.*}
case ${1%.*}
It should work with either ' ' or " " quotes.
[edit]
To get rid of all the zeros you could try:
echo ${1%.*}
case ${1%.*}
Last edit: 5 years 1 month ago by Aciera.
The following user(s) said Thank You: my1987toyota
Please Log in or Create an account to join the conversation.
- my1987toyota
- Offline
- Platinum Member
-
Less
More
- Posts: 1004
- Thank you received: 449
5 years 1 month ago #220582
by my1987toyota
Replied by my1987toyota on topic Bash M1## how to use the P word
Okay. That makes sense.Aciera post=220580 userid=25994I believe the quotes depend on the location setting.
It should work with either ' ' or " " quotes.
Please Log in or Create an account to join the conversation.
- anfänger
- Offline
- Platinum Member
-
Less
More
- Posts: 647
- Thank you received: 267
5 years 1 month ago - 5 years 1 month ago #220595
by anfänger
Replied by anfänger on topic Bash M1## how to use the P word
Yes I am in Germany sorry for the strange quotation marks.
, and as I pointed out this looks like a float int problem. You try to compare an intern with a float, and that doesn‘t work
Aciera already pointed you into the right direction try this
#!/bin/bash
P = ${1%.*}
Q = ${2%.*} # in case you want to use the second parameter to
echo " P: ${P} Q: ${Q}";
case $P in
1) echo „case true“
halcmd setp classicladder.0.in-50 true ;;
esac
exit 0
as soon as everything work you can remove or comment the echos. This is my stupid way of debugging
, and as I pointed out this looks like a float int problem. You try to compare an intern with a float, and that doesn‘t work
Aciera already pointed you into the right direction try this
#!/bin/bash
P = ${1%.*}
Q = ${2%.*} # in case you want to use the second parameter to
echo " P: ${P} Q: ${Q}";
case $P in
1) echo „case true“
halcmd setp classicladder.0.in-50 true ;;
esac
exit 0
as soon as everything work you can remove or comment the echos. This is my stupid way of debugging
Last edit: 5 years 1 month ago by anfänger.
Please Log in or Create an account to join the conversation.
- my1987toyota
- Offline
- Platinum Member
-
Less
More
- Posts: 1004
- Thank you received: 449
5 years 1 month ago #220742
by my1987toyota
Replied by my1987toyota on topic Bash M1## how to use the P word
I tried the new suggested code and unfortunately it didn't work for me.
I think Linuxcnc has the M100 through M199 specifically coded to just
pass through the P and Q floats to a hal component and wont let you
use them in case, or if statement arguments.
I think Linuxcnc has the M100 through M199 specifically coded to just
pass through the P and Q floats to a hal component and wont let you
use them in case, or if statement arguments.
Please Log in or Create an account to join the conversation.
- anfänger
- Offline
- Platinum Member
-
Less
More
- Posts: 647
- Thank you received: 267
5 years 1 month ago #220765
by anfänger
Replied by anfänger on topic Bash M1## how to use the P word
I use around 20 different bash written m codes with if or case statements it works.
I also have a debug m code that uses zenity to show the p and q.
I don’t have Access to my machines now. So I can’t attach them. But if can read german you’ll find some at barn.works in my blog entries for the mill conversion
I also have a debug m code that uses zenity to show the p and q.
I don’t have Access to my machines now. So I can’t attach them. But if can read german you’ll find some at barn.works in my blog entries for the mill conversion
The following user(s) said Thank You: my1987toyota
Please Log in or Create an account to join the conversation.
Time to create page: 0.164 seconds