I am trying to run a simple Bash script called
deploy-site.sh (by http://klau.si/dev). I made the necessary edits to run it locally (change of WORKDIR, etc). I also followed the instructions here.
mkdir ~/bin chmod 755 ~/bin
(To store the script in my home folder. Then I rebooted, so the system recognizes it.)
sudo chmod +x <path> sudo chmod 755 <filename>
However, whenever I go to the terminal to execute the Bash script, I get:
$ sudo deploy-site.sh <sitename> sudo: deploy-site.sh: command not found
How can I fix this problem?
Here is the original script:
#!/bin/bash if [[ $# -lt 1 || $1 == "--help" || $1 == "-h" ]] then echo "Usage:" echo " sudo `basename $0` SITENAME" echo "Examples:" echo " sudo `basename $0` drupal-8" exit fi WORKDIR="/home/klausi/workspace" APACHEDIR="/etc/apache2/sites-available" HOSTSFILE="/etc/hosts" echo "<VirtualHost *:80> ServerAlias $1.localhost DocumentRoot $WORKDIR/$1 <Directory \"$WORKDIR/$1\"> Options FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost>" > $APACHEDIR/$1.conf a2ensite $1 service apache2 restart grep -q "127.0.0.1 $1.localhost" $HOSTSFILE if [ $? -ne 0 ]; then echo "127.0.0.1 $1.localhost" >> $HOSTSFILE fi
As requested, here is the results of echo
~/binand reboot doesn't mean that the system recognizes it - you need to add it your
echo $PATHto your question.
echo $PATHto see if the directory does not appear in $PATH for some reason. @Wilf it should be in $PATH after log out/in or running