Set a variable in a subshell
examples/script/change_term.sh
#!/bin/bash echo $TERM TERM=xterm echo $TERM
$ echo $TERM xterm-256color $ ./examples/script/change_term.sh xterm-256color xterm $ echo $TERM xterm-256color
#!/bin/bash echo $TERM TERM=xterm echo $TERM
$ echo $TERM xterm-256color $ ./examples/script/change_term.sh xterm-256color xterm $ echo $TERM xterm-256color