Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of the -U option in Zsh's autoload

Tags:

zsh

The man page for zsh mentions for the autoload command an option -U, but doesn't explain it. However, it refers for unexplain options to the functions command. Looking up functions in the man page, I see that it indeed accepts -U, but it isn't explained either.

In examples on the Net, I sometimes see autoload used with and sometimes without -U. What is this option doing, and where is it explained? The explanation must be somewhere in the zsh man pages, but I couldn't find it.

like image 607
user1934428 Avatar asked Oct 28 '25 03:10

user1934428


1 Answers

autoload is equivalent to functions -u, and functions is in turn equivalent to typeset -f.

If you look up the section on typeset in the zshbuiltins(1) man page, you’ll finally find your answer:

The -u and -U flags cause the function to be marked for autoloading; -U also causes alias expansion to be suppressed when the function is loaded.

like image 107
wjv Avatar answered Oct 30 '25 03:10

wjv



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!