I am trying a simple xterm command:
xterm -hold -e "hare=0;echo $hare"
it will open xterm with blank
What i observed is variable hare is not getting defined inside the -e quotes
where as:
hare=0;xterm -hold -e "echo $hare"
it opens an xterm showing 0
i have to define variables in the -e quotes and do something. Is it possible or not. I want xterm to access the outside variables and also the variables defined in the -e
Variables are expanded inside double-quoted strings, so the variable is being expanded by the original shell, not the shell in the
xterm
. Use single quotes.If you assign the variable in the original shell, you need to export it so it will become an environment variable that's inherited by child processes: