Unix / Linux: TCSH / CSH Shell Set Variable

Unix / Linux: TCSH / CSH Shell Set Variable

To set a variable in the TCSH (TC Shell) or CSH (C Shell) shells on Unix or Linux, you can use the set command. For example, to set a variable called FOO to the value bar, you can use the following command:

refe‮:ot r‬lautturi.com
set FOO=bar

You can also use the setenv command to set environment variables in TCSH or CSH. For example, to set the PATH environment variable, you can use the following command:

setenv PATH /usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin

To display the current value of a variable, you can simply type the name of the variable. For example, to display the value of the FOO variable, you can use the following command:

echo $FOO

To unset a variable, you can use the unset command. For example, to unset the FOO variable, you can use the following command:

unset FOO
Created Time:2017-10-30 14:27:30  Author:lautturi