Search code examples
terminalzshzshrc

What is the meaning of flag -s in this command?


I have met a command to load nvm environment in .zshrc, but I don't know what it exactly does with flag -s. I know that the square bracket is condition to check whether folder in this command exists or not. But don't know what -s does.

[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm

Does anyone know the flag -s in this command? Thank in advance.


Solution

  • [ is the same as test. Checking test's manpage:

    -s file       True if file exists and has a size greater than zero.
    

    Update: Actually, using man '[' works, too.