Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • Love the idea! Follow up questions: 1. From a practical standpoint: Do you think there are advantages to what waltinator suggests? 2. Would the ps --no-headers -o cmd $(ps --no-headers -o ppid $$) replace everything in the above code, or only the code in has_ancestor(){...}? Commented Jul 17, 2024 at 9:09
  • 1
    @Make42, 1) waltinator's suggestion is to launch kile in an environment with history disabled. That probably works, but it's inconvenient, and will only help if you remember to use it every time. (That said, if you meant using the environment changes instead of set -o history, that might work also, but seems more round-about than set -o history.) 2) See edit. It would probably be beneficial to learn enough shell to understand how both functions actually work rather than just trusting what I wrote. 🙂 Commented Jul 17, 2024 at 17:13
  • @Make42, looking at the output of ps --no-headers -o cmd will only work if the command-line used to invoke Kile is exactly kile, not /usr/bin/kile, kile <args...>, or a combination thereof. The version in the edit retains robustness against these, only discarding the test against any ancestor process. If you were to write it inline, you would write something like if [ $(ps --no-headers -o cmd $(ps --no-headers -o ppid $$)) == kile ] instead of the if ... shown in the Answer, but mind the caveats in the beginning of this comment. Commented Jul 17, 2024 at 17:21
  • 1
    Shouldn't it be set +o history instead of set -o history? digi.ninja/blog/hiding_bash_history.php Commented Jul 19, 2024 at 9:57
  • 1
    Regarding "what is the difference to waltinator's suggestion": Your solution works independently from where (konsole, start menu, etc.) I call kile. Commented Jul 19, 2024 at 10:03