10

All I want to do is pass mailto: links to urxvt -e mutt -F ~/path/to/muttrc with the rest of the mailto: URL appended. I've tried every script I can find online that purports to do this, from simple:

#!/bin/sh
exec "urxvt -e mutt -F /path/to/muttrc \"$@\""

to complex, and the most they do is open a terminal window for a split second before it automatically vanishes again (and there is no evidence of a running mutt process). Any suggestions?

1 Answer 1

4

Remove the quotes, or the shell will try to execute the full string as a command (which obviously does not exist).

#!/bin/sh
exec urxvt -e mutt -F /path/to/muttrc "$@"

Not tested, but the presence of quotes is the explanation for the vanishing of the terminal.

5
  • Thanks Stephane. It works. I admit to confusion about when to quote $@ and when not to. Commented Sep 10, 2011 at 10:40
  • 1
    "$@" will result in as many words as the number of arguments. With $@, all the arguments will be collapsed and word-split again (usually that's not what you want). Commented Sep 10, 2011 at 10:49
  • 1
    I have tried this with firefox and I can't seem to get it to work. I used the EXACT string above (modifying the arg to -F and removing -F and the arg entirely) and for me the console still vanishes.. Commented Mar 30, 2013 at 4:15
  • I think the problem is, that some terminal emulators don't pass on additional arguments. E.g. if you use the terminator term, it provides an -x option, which passes conveniently additional arguments to the executing command. Commented Aug 13, 2013 at 2:31
  • @romanofski: You're right, with termite for example, it's exec termite -e "mutt \"$@\"". Commented Feb 12, 2020 at 13:14

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.