You could also define a function like
function surh() { sudo "$@" ; rehash ; }
in your ~/.zshrc and skip the extra script file.
s.
"[email protected]" <[email protected]>, 31.10.2018, 16:36:
> Hi Anton,
> thank you very much ! :)
> Your solution creates the flat-hand-against-my-forehead
> effect... ;)
> Of course! Yes!
> Cheers!
> Meino
> On 10/31 07:37, Anton Molyboha wrote:
>> Hi, Meino
>>
>> I'd make a script, sudo_with_rehash:
>>
>> sudo "$@"
>> rehash
>>
>> and add to whatever is the equivalent of .bashrc for zsh:
>>
>> alias sudo="source sudo_with_rehash"
>>
>> Would that work for you?
>>
>> Best,
>> Anton
>>
>> On Wed, Oct 31, 2018 at 4:49 AM <[email protected]> wrote:
>>
>> > Hi,
>> >
>> > often I have this scenario:
>> > I miss an application/script, a setting or something like that.
>> > To apply the modifikation I becom root from the shell I was using as user.
>> > I modificate/install or whatever change is needed...
>> > I CTRL-D back to my user shell.
>> >
>> > Now I have to do a "rehash" (I am using zsh) to make the change
>> > visible/accessible. Sometimes I forget that.
>> >
>> > So...is it possible to auto-execute a "rehash" or whatever is needed,
>> > when the user is comeing back from his alternate life as root?
>> >
>> > Thanks a lot for any help in advance!
>> > Cheers!
>> > Meino
>> >
>> >
>> >
>> >
--
Stefan Schmiedl
EDV-Beratung Schmiedl, Berghangstr. 5, 93413 Cham
Büro: +49 (0) 9971 9966 989, Mobil: +49 (0) 160 9981 6278