Asumming your subnetmasks are equal:
At least linux kernel 4.19 has a bug regarding your observation.
Adding 2 IP addresses in the same subnet to one interface and deleting the first one, will delete both:
ifconfig eth0 18.104.22.168/24
ifconfig eth0:2 22.214.171.124/24
ifconfig eth0 0
But remember that this is still a misconfiguration to have 2 IP addresses ...
I have been frustrated by this problem with df and found a good replacement in the Ubuntu/Debian repos: di (disk information)
apt install di
It looks and feels almost identical to df
but can be configured with a env var DI_ARG so in my ~/.bash_profile I have the following line to show full names, human readable disk space for physical drives:...
One may change something temporarily and then try to return it back to the state it was before. But I propose better, cleaner, more reliable and better maintainable approach: just make needed change local.
Bash allows you to easily achieve that by using a subshell (more info here - Grouping Commands).
In your case it can be done like this
alias x='( set -f;. ...
From the bash man page:
Aliases allow a string to be substituted for a word when it is used as the first word of a simple command.
As sjc-tftp is not the first word in cd sjc-tftp it won't be expanded. To achieve what you are attempting you could use a simple shell variable $sjc-tftp or make the alias include the cd command eg: alias sjc-tftp="cd /auto/...