I’m looking for a function that would return 1 if a shell command exists, and 0 otherwise
I know there is the which command that returns the path of a command if it exists. It also says in the manual that this command is supposed to have a return value, but trying
set a = `which some_command.bin` doesn’t put any value into a.
I know that I can always use which then parse the results, I’m just looking for a cleaner solution
I’m looking for a function that would return 1 if a shell command exists,
Share
The return value for a shell command is not usually retrieved like that. You generally need to run the command, then the special environment variable
$?will give you the return value.See the following transcript for
tcsh:Just put whatever command you want to check for where I have
lsabove.