Trying to use Terminal for Display Notification

Hi all !
In macOS Sequoia, if I run in SD:
display notification "Hi all"
it works as expected.

But if I use in Terminal:
osascript -e 'display notification "Hello from me" with title "Hello"'
is not working!!

But “display dialog” works perfectly:
osascript -e 'display dialog "Hello from me" with title "Hello"'

I don’t understand why display notification cannot be triggered from Terminal anymore…
Any Help ?
Thanks

Luciano

Works for me.
Have you activated the focus mode? I had to add the Script editor to the allowed apps to make the notification visible.

This is the answer. If I have Focus turned on, the notification doesn’t appear. If I have Focus turned off, it appears.

Unfortunately is not matter of ‘Focus’ since: 1) is not active; and 2) I do get notifications if I invoke Display Notifications from the Script Debugger. But I do not get any notification when I run the same command from Terminal.
Any other idea?

Then execute the command again in the Script Editor (not Script Debugger) and see if the notification is displayed. If not, then check the notification setting of the Script Editor. It seems that osascript is running in its context and there are separate settings for notifications for each app.

Otherwise you could try the following again:

osascript <<EOF
	display notification "Hello from me" with title "Hello"
	delay .5
EOF

I did run in Script Editor (and not in SD):
display notification "Hi all"

It actually asked me to allow Notifications for Script Editor!
And – as expected – I got the notification.

I then run in the Terminal (as Dirk suggested):
osascript <<EOF
display notification “Hello from me” with title “Hello”
delay .5
EOF

and it also worked!!!

Finally I run the code that initially for me was not working:
osascript -e 'display notification "Hello from me" with title "Hello"'

But NOW it worked!!!

Thanks a lot Dirk !!!