I am looking for a multi-platform solution that would allow me to check if a team is available scp.
scp
The problem is that scp does not have a command line --versionand, when called without parameters, returns with an exit code 1(error).
--version
1
Update: in case this was unclear, by a multi-platform I mean a solution that will work on Windows, OS X and Linux, without requiring me to install anything.
Use the command which scp. This allows you to find out if the team and its path are available. If scp is unavailable, nothing is returned.
which scp
#!/bin/sh scp_path=`which scp || echo NOT_FOUND` if test $scp_path != "NOT_FOUND"; then if test -x ${scp_path}; then echo "$scp_path is usable" exit 0 fi fi echo "No usable scp found"
sh , , . , -x - , , , . , , - .