0

I have a script.sh that runs xterm, I do not have write access to script.sh , .bash_profile , I cannot change it.

I want to change the font size of xterm, I changed ~/.Xresources as described. No effect.

I tried alias xterm = "xterm -fa Monospace -fs 16" , this works when I open an xterm, but when I execute script.sh, it does not work, (i.e. again it comes with default font. )

How can I increase the font size of xterm that runs inside a script that I cannot edit?

2 Answers 2

1

Create a short executable shell script called xterm in a directory somewhere where you can write, for example in ~/bin.

The script should execute xterm with the options you want, and also with whatever options are passed from the caller:

#!/bin/sh

/usr/local/bin/xterm -fa Monospace -fs 16 "$@"

Replace the path above with the real path to xterm on your system (see the output of command -v xterm).

Then, call script.sh with an altered PATH variable:

PATH=~/bin:$PATH ./script.sh

... where ~/bin is the path to the directory where you created your xterm script. By putting ~/bin first in PATH, your script will be found before the real xterm executable when the script.sh script uses xterm.

This effectively overloads the xterm utility for the script.sh script.

This will not work if script.sh uses xterm with an absolute path, or if it resets the value of the PATH variable.

0

If you source the script it will use your alias. Try . script.sh or source script.sh (they do the same thing).

0

You must log in to answer this question.

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