Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7995

Other programming languages • Re: Trying script to get motionEye alerts on Telegram

$
0
0

Where does '/' come into this ?
That is called a forwardslash on Linux, while the '\' is called a backslash.

If you write a bash script, you can declare and set a variable with something like:

Code:

user_name="hortimech"
Which you can print with:

Code:

echo "username = $user_name"
Which should produce:

Code:

username = hortimech
But, if you change the code to:

Code:

echo "$user_name = $user_name"
That will produce:

Code:

hortimech = hortimech
and if you add the escape character '\' like this:

Code:

echo "\$user_name = $user_name"
you will get this:

Code:

$user_name = hortimech
And writing all this, I realised what is happening :)

You are sending the message to a function which uses printf to print it, printf works very similar to 'echo', so it gets "DATE - $user_name is hortimech" and tries to expand '$user_name", which, because it isn't set as a local variable, it does. I still do not see why this stops your script from working. This is mainly because I do not know just how the script is being called.
You're right, my headache is making me fail...
Thank you for digging into this! I tested and you're right about the output. What do you need to know? Do you mean how the script is ivoked by motionEye? I is added to the motion notifications section, exactly as action to run at the end of the motion:

Code:

/home/my_username/.config/motioneye-telegram/bin/motion-send.sh %$ %t
Looking into the camera*.conf file, you can see motionEye runs in "codeon_event_end":
[/usr/local/lib/python3.13/dist-packages/motioneye/scripts/relayevent.sh "/home/my_username/.config/motioneye/motioneye.conf" stop %t; /home/my_username/.config/motioneye-telegram/bin/motion-send.sh %$ %t][/code]

Notice I'm running motionEye as user and I moved the script folder into /home/my_username/.config

Statistics: Posted by Raspbop — Mon Jan 26, 2026 10:31 pm



Viewing all articles
Browse latest Browse all 7995

Trending Articles