When using the interactive Macports shell (running port), is there a way to delete characters to the right of the cursor?

Normally, you can simply use key the combination Fn + Delete to forward-delete. However, when this is used, the result is the production of a ~ (tilde) character.

My bash version is: GNU bash, version 3.2.53(1)-release (x86_64-apple-darwin11). My Macports version is: Version: 2.5.4. My OS X version is: 10.7.5 Lion.


UPDATE: As mentioned by daniel Azuelos, control+d will delete forwards one character at a time. However, this is dangerous - if there is no text to be deleted, it will exit the interactive shell as well as the terminal (at least using bash).

  • I suggest you to make another question with your UPDATE, because this is a more general question and is in no way related to Macports. Otherwise people who might help you won't even read your question with its actual title. As a general rule, it is a bad idea to try to overload a question with another one just because you received a positive answer. It is much more efficient to close a question at a time. – dan May 26 '19 at 8:42
  • Well, I'm not certain that this is a general question because you can forward delete under most circumstances with Fn+Delete -- but not in Macports interactive mode. – I_Don't_Code May 26 '19 at 23:45
  • @danielAzuelos See here for the clarified question: apple.stackexchange.com/questions/360961/… – I_Don't_Code May 27 '19 at 1:03

I didn't test it with Lion, but there is a high probability that control+d would delete the character to the right of the cursor, and control+k would delete everything to the end of line.

| improve this answer | |
  • control+k does delete all characters to the right of the cursor. control+u also deletes the whole line entered into Macports's interactive shell. – I_Don't_Code May 25 '19 at 19:34
  • control+d does work! So it is technically the answer to my question, but it's dangerous to use because it will also exit out of the shell, as well as the terminal itself, if there is no text available to delete. – I_Don't_Code May 25 '19 at 19:36
  • [answer to comment 1] You are right, same thing here with High Sierra 👍🏻. – dan May 25 '19 at 19:36
  • Same shortcut as within the bash command line editing with the same risk. I bet it would work the same way on Lion. – dan May 25 '19 at 19:39
  • Is there a safe alternative? – I_Don't_Code May 25 '19 at 19:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .