Page MenuHomeDevCentral
Paste P298

/usr/local/bin/run-php-script
ActivePublic

Authored by dereckson on Feb 8 2022, 17:02.
Tags
None
Referenced Files
F1691043: /usr/local/bin/run-php-script
Feb 8 2022, 17:02
Subscribers
None
#!/bin/sh
COMMAND=$1
shift
if [ -f vendor/bin/$COMMAND ]; then
echo "Switching to Composer $COMMAND:"
SCRIPT=vendor/bin/$COMMAND
elif [ -f /opt/$COMMAND.phar ]; then
SCRIPT=/opt/$COMMAND.phar
else
SCRIPT=$(which $COMMAND) 2> /dev/null
if [ $? -ne 0 ]; then
echo "No $COMMAND has been found."
exit 1
fi
fi
php $SCRIPT "$@"