Hacker News new | past | comments | ask | show | jobs | submit login

Indeed, which does not recognize aliases and functions, so `command -v` seems better:

    command -v llh >/dev/null 2>&1 ; echo $?
    0 # good
    usr/bin/which llh >/dev/null 2>&1 ; echo $? 
    1  # good
however (zsh) shell internal which does:

    which llh ; echo $?  
    llh='ls -lh'
    	/usr/bin/ls
    0 #good
(I'm not sure however when ZSH chooses to use its internal function or the one from $PATH)



Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: