I wrote a script whilst on ubuntu 12.04.5 which ran through fine however after upgrading to 14.04.2 to fix another issue i am now having issues with the script.
It is halting at the first set of commands and i cannot seem to identify why; i made amendments based on google results however each change results in more errors.
The part of the script its currently stalling at is
#!/bin/bash
V=1.5.4
DELAY=3
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
sleep 5
exit 1
fi
while [[$REPLY != 0 ]]; do
clear
cat <<- _EOF_
Please Select:
1. Menu option 1
2. Menu option 2
3. Menu option 3
4. Menu option 4
5. Menu option 5
6. Menu option 6
7. Menu option 7
0. Exit
_EOF_
read -p "Enter selection [0-7] >"
if [[ $REPLY =~ ^[0-7]$ ]]; then
if [[ $REPLY == 1 ]]; then
When I run the above script using sudo ./config.sh
I receive the error
./config.sh: line 23 [[: command not found
When i remove the extra brackets i receive the error
./config.sh: line 23: [: !=: unary operator expected
In the full script the line containing while [[$REPLY != 0 ]]; do
is line 23
Adding quotes to $Reply
also results in the same error.
I don't understand what has changed within bash since upgrading to the newer LTS. Any help would be appreciated.
while [[ $REPLY -ne 0 ]]
while comparing numerics..