Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ol> <li><p>Add the shebang line to the top of the script:</p> <pre><code>#!/bin/bash </code></pre></li> <li><p>Variable assignment is done without the dollar sign:</p> <pre><code>installerver=1.1 </code></pre></li> <li><p>Variable assignment from a subshell command uses parenthesis not braces:</p> <pre><code>installedver=$(cat /var/www/html/gvsms/.version) </code></pre></li> <li><p>There's a bad <code>fi</code> in your if block</p></li> <li>You're missing an <code>else</code> block</li> <li>You should probably test if the file exists before cat'ing it.</li> <li>You should double-quote all your variables</li> <li>You need spaces inside conditional brackets <code>[ … ]</code> and <code>[[ … ]]</code></li> </ol> <p>This will get your code running:</p> <pre><code>#!/bin/bash installerver="1.1" echo "Installation beginning...." echo " " echo " " echo -n "Checking to see if GVoice SMS Notification System was previously installed..." if [ -e "/var/www/html/gvsms/index.php" -a -r "/var/www/html/gvsms/.version" ]; then echo "Yes." echo "" echo "I have detected a previous installation of GVoice SMS Notification System." if [ "$(cat /var/www/html/gvsms/.version)" == "$installedver" ]; then echo "The GVoice SMS Notification System is currently installed and is the same version as this installer. If you were trying to upgrade, please check the installer you downloaded and try again." exit elif [ "$installedver" == "0.5" || "$installedver" == "1.0" ]; then while [[ "$yn" != "Yes" &amp;&amp; "$yn" != "Y" &amp;&amp; "$yn" != "y" &amp;&amp; "$yn" != "yes" ]]; do echo "Would you like to upgrade? Yes or no." read -r upgrade echo "$upgrade upgrade?" echo "Is this correct? (Yes or No)" read yn done echo "Upgrade proceeding..." fi else echo "No." echo "I have not detected a previous installation of GVoice SMS Notification System." read -p "To proceed with installation at your own risk, press Enter. Otherwise Ctrl-C." fi </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload