Even better still, you use a text editor to enter those alias commands and variable assignments into a file that is read by bash when it is started up and they will be available when you run bash. One such file is .alias in your home directory (note the . in front). For example you put lines like:
and so forth in it and next time you login or start a bash shell, they will be available.
PS: ~/.alias is not a file that’s documented as read by bash if you are wondering, but the default .bashrc (which is normally read by bash) on openSUSE has this line at the end:
What exactly did you do? Do you understand that you can’t “save” your current settings, but you write them down so that they are read in by each shell? So you have to put all the assignments you made into that file. Any new ones you make during a session are not “saved”.
You would have to dump the variable assignments to a file and then arrange to read them in again later. This is a scripting problem. There are no ready made commands for this because usually people put what they want to be “permanent” in .bashrc or .aliases and don’t want to carry over the assignments from a previous session. But the tools are there to do this.
There no such ready made scripts, you will have to write them. If you don’t know shell scripting, you will have to learn. Here are some hints:
The shell builtin command “set” will print out all variable and function assignments, and the output can be directed to a file. Similarly the command “alias” prints out all aliases. Those assignments can be read in again from a file with the “source” command. However you want to be selective with what you read in again. You could easily lock yourself out of the computer if you get your shell to automatically read everything in, including assignments that are mistakes.
On 12/01/2015 03:36 PM, speedytux wrote:
> You can test this.
> create a .alias file in your home directory
> add some aliases like
> alias zy=“sudo zypper”
> then save and exit
> chmod +x .alias
This step is not necessary just use:
to have the file re-sourced.
linux since 1994
S.u.S.E./openSUSE since 1996