which zypper returns usr/bin/zypper so I tried to replace the zypper in my alias with that, as such:
alias update="sudo /usr/bin/zypper refresh && sudo /usr/bin/zypper dup"
The command itself still works however I still get the same ānot foundā errors when opening a terminal.
I restarted my pc to be sure.
zypper lr -E returned the following table, it seems auto-refresh is on.
The reason I have the zypper refresh command is because I had to run that once to update vs code, could be that the auto refresh is only executed occasionally?
Iām not very good with bash scripting but I messed around a bit with your suggestions however I still cant get rid of the error messagesā¦
I tried to create the sudo alias as you suggested but it didnt change anything.
I tried to create a local function in the .alias file that gets called by an alias aswell :
I could still update my system with the update alias however the errors are still there when I open a terminal.
Finally i tried moving the update function to its own file, .updateWithZypper.sh and then I called that from the alias as such:
alias update='. ~/.updateWithZypper.sh'
Still works but with the same error messagesā¦
EDIT:
I tried to remove my alias command and only have the bash script with the update function in my home folder but I still get the same errors, could it be something else that is causing these errors then?
Iām not entirely sure how this helps, but the su - command is nice to know however!
But I get the same error message when I run it, basically I just donāt need to use āsudoā while Iām in the root shell right?
It seems more like Iāve created an alias that contain zypper somewhere that it doesnāt likeā¦
I have tried to grep for it but no luck so farā¦
Bash alias command does pure textual substitution. It does not try to interpret the content of alias, nor is this content interpreted when alias is substituted.
Do you get the same errors when you simply invoke bash?
sudo comes with configuration files. Settings are different for different distributions, which frequently starts effing discussions.
su - is easy. sudo ... comes with side effects, see above.
You may want to read the fine manual. From man alias:
OPERANDS
The following operands shall be supported:
alias-name
Write the alias definition to standard output.
alias-name=string
Assign the value of string to the alias alias-name.
If no operands are given, all alias definitions shall be written to standard output.
In the file typescript that was created in the current directory I found the following lines:
...
+ test -s /etc/bash.bashrc.local
+ . /etc/bash.bashrc.local
++ alias dup=sudo zypper refresh
bash: alias: zypper: not found
bash: alias: refresh: not found
...
By removing this āaliasā line from /etc/bash.bashrc.local the ānot foundā warnings stopped appearing every time I opened a terminal.
My alias is now only defined in ~/.alias as:
alias update="sudo zypper refresh && sudo zypper dup"
which works and there are no warnings.
As a side note; executing the āaliasā command in the terminal did not display the āaliasā that was ādefinedā in /etc/bash.bashrc.local