Of course for your particular issue you want to follow @chaos and @steeldriver advices, but in the general case, in order to "permanently store values in the terminal", you are looking to shell variables. How to set them will depend on your shell (I guess echo $SHELL
will provide the relevant information).
If by "permanently" you mean "as long as I don't exit this terminal session", then you can simply use the export server1=111.222.111.222
command if you're using a bash
-based shell (setenv server1 111.222.111.222
for a csh/tcsh
-based shell, if I remember correctly). Then you can access your variable by prefixing it with $
: ssh root@$server1
.
If by "permanently" you mean "each time I launch a new terminal", then you will need to set your variable in one of the shell init files. E.g. in $HOME/.bashrc
for bash
-based shells, or $HOME/.cshrc
— presumably using the same syntax as mentionned in the previous paragraph. Note that you will have to source the init file (e.g. source $HOME/.bashrc
or open a new shell for changes to be taken into account.
NB : Answer from memory, may require some small adjustments.