1

I have a few files on my computer that I need to compile frequently while editing, e.g.:

context file.tex

I tried to add a launcher to the XFce4 panel that will open xfce4-terminal and compile this code, however, none of the commands I try in the launcher preferences window work.

How can I add a launcher to the XFce panel which opens a terminal, compiles, and after finishes leaves the terminal open?

4

In the launcher preferences window, enter this as the command:

bash -c "context file.tex; exec bash"

Then check the option "Execute on terminal".

That will execute Bash on terminal, running the 2 commands between quotes, instead of an interactive shell. The first one is, of course, your compiling. The second one replaces our non-interactive shell with a interactive one, so you can use it after the compiling finishes.

  • This opens a terminal and says, "bash: context: command not found". Perhaps it does not run .bashrc? – Village May 28 '13 at 8:55
  • Yes, from Bash manual: "When Bash is started non-interactively, to run a shell script, for example, it looks for the variable BASH_ENV in the environment, expands its value if it appears there, and uses the expanded value as the name of a file to read and execute." So, is "context" an alias? If so, my suggestion is that you change it in the launcher for the actual command it represents. Alternatively, you could source your aliases to the file defined in BASH_ENV. In this case, you should also be sure to set expand_aliases (shopt -s expand_aliases). – Rafael Cavalcanti May 28 '13 at 9:30
  • @dvrc No, it's not an alias. It's a one line shell script, a wrapper for mtxrun. @Village You can set up the PATH to point to the standalone directory for this single invokation only by prepending PATH=… context file. – Marco May 28 '13 at 10:08
  • What does PATH=... do? – Village May 28 '13 at 22:39
  • @Village PATH is an environment variable containing directories where to Bash look for when you enter a command. Context is located in /usr/bin. If /usr/bin is not on $PATH, you get that error ("command not found"). You can check $PATH substituing "context file.tex" in the command I wrote for "echo $PATH". – Rafael Cavalcanti May 29 '13 at 4:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.