Project

General

Profile

Bug #1565

How to get a bash script to return true on function key press (for use as a Sylpheed filter)

Added by Thomas Keller 6 months ago. Updated 8 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
06/07/2022
Due date:
% Done:

0%

Estimated time:

Description

I'm currently trying to make a filter rule on Sylpheed that deletes a message from server on command, and I was thinking of writing a bash script that returns true when you press something like say, F8, then use that as an argument.

Unfortunately, that appears to be harder than expected. I've tried this code so far:


#!/bin/sh
f8='^[[19~'
f9='^[[20~'
echo please enter the F8 function key
read -n5 key                      # Read 5 characters.
echo -n "$key" | grep "$f8"  #Check if character code detected.
if [ "$?" -eq $SUCCESS ]
then
  echo "F8 key pressed." 
  return 0
fi
echo -n "$key" | grep "$f9"  #Check if character code detected.
if [ "$?" -eq $SUCCESS ]
then
  echo "F9 key pressed." 
  return 0
fi

that I found on the net and modified a bit, but unfortunately it doesn't seem to work (using Fedora LXDE). I got the keypress data for the F8 and F9 keys via using control-v in the terminal, then pressing F8 and same for F9. BdV en Linea

I've tried variations of it, by deleting the ^ and changing the read -n5 to read -n4, but grep still keeps saying "grep: Unmatched" etc. Can anyone help out?

Also open to anyone who can show me how to create a filter on Slypheed to delete an email from a server as an alternative solution (apparently it is possible, but I have not been able to get it to work; currently testing it on a gmail account, and any message deleted in the client is not deleted on gmail, and I can't seem to get the filter to run on flagged messages, or coloured messages, or any variation of the above that lets the user select the messages that they want to delete from the server). I cannot switch to IMAP because of client specifications.

#1

Updated by seo mind 8 days ago

wow... what a great blog, this writter who wrote this article it's realy a great blogger, this article so inspiring me to be a better person scam risk

#2

Updated by seo mind 8 days ago

It is perfect time to make some plans for the future and it is time to be happy. I've read this post and if I could I desire to suggest you some interesting things or suggestions. Perhaps you could write next articles referring to this article. I want to read more things about it! scam risk

#3

Updated by seo mind 8 days ago

Thanks for the best blog. it was very useful for me.keep sharing such ideas in the future as well. scam risk

#4

Updated by seo mind 8 days ago

This is a splendid website! I"m extremely content with the remarks!. scam risk

#5

Updated by seo mind 8 days ago

Wow what a Great Information about World Day its exceptionally pleasant educational post. a debt of gratitude is in order for the post. Anthony Morrison Review

#6

Updated by seo mind 8 days ago

I enjoy it for creating the details, keep up the truly amazing perform continuing scam risk

#7

Updated by seo mind 8 days ago

I see some amazingly important and kept up to length of your strength searching for in your on the site scam risk

#8

Updated by seo mind 8 days ago

Three are usually cheap Ralph Lauren available for sale each and every time you wish to buy. scam risk

#9

Updated by seo mind 8 days ago

This is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the good work. I have been meaning to write something like this on my website and you have given me an idea. scam risk

#10

Updated by seo mind 8 days ago

I truly like you're composing style, incredible data, thankyou for posting. scam risk

#11

Updated by seo mind 8 days ago

Cool you write, the information is very good and interesting, I'll give you a link to my site. scam risk

Also available in: Atom PDF