1

When I type in the command alias I get some funny things I don't understand:

rick@dell:~$ alias
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'

The first command / alias seems to do nothing when I type:

rick@dell:~$ alert "It's raining"

How, where, when and why is this alert command supposed to be used in an alias?


Duplicate close thoughts:

The proposed duplicate explains alert alias to great extent but doesn't explain why typing Alert "It's raining" does NOT result in a notification bubble.

The question above does ask for complete explanation though which the CV duplicate satisfied.

A day after the above question was posted a new Question with "provide your own Answer" option was posted here: (notify-send (alert) not popping-up GUI bubble messages) and it solves the reason for posting the above question in the first place.

The above CV candidate question can almost be considered "too broad" because it is seeking advice about aliases AND ~/.bashrc AND notify-send.

I have voted to close this question as a duplicate too.

1 Answers1

1

There's an unclosed quote in It's raining. bash is waiting for you to close the quote behind the scenes so it appears it's not working. Try a single word without an apostrophe or even "CamelCase" or close the quote like alert It's raining'

Another possibility that might make you think the alert alias isn't working is a window with the always-on-top modifier over the upper right quadrant of your desktop.

Elder Geek
  • 36,023
  • 25
  • 98
  • 183
  • actually the first attempt was "Help Me~~~~" but that didn't work either. As in comment above it was because TV was maximized with "always on top" option, and "normalizing" the window allowed the notification bubble to appear. I did upvote your "How to backup a desktop PC" answer for all your hard work on this topic. Thank you! – WinEunuuchs2Unix Nov 09 '16 at 04:12
  • No worries, I enjoyed it! – Elder Geek Nov 09 '16 at 04:12
  • 1
    A single quote inside double quotes is literal. E.g. run echo "It's" – wjandrea Nov 09 '16 at 04:25
  • @wjandrea That's true. I'm not sure why I wasn't alert enough to catch that. ;-) – Elder Geek Nov 09 '16 at 13:07