4

I use RaspberryPi 3. I would like to make it a hotspot if it can't find RaspbarryPi 3 auto wifi hotspot if no internet. The tutorial shows a code to edit rc.local file.

Please find my code of rc.local file below: http://pastebin.com/3mRXHCUG

When I debug the file, it shows error at line 39 as " Syntax error: "(" unexpected"

The code of line 39 is as follow:

ssids= ("Bhavik","iBall-Baton")

So RaspberryPi always crates hotspot no matter if the specified Wifi connections are available.

Kindly help me. Thanks.

HarshIT
  • 235
  • 1
  • 4
  • 13

2 Answers2

1

The issue is the way you are attempting to define your array. Basically, rc.local is written in bash scripting, and defining an array as

ssids= ("Bhavik","iBall-Baton")

isn't bash; it won't work. If you want to define the array manually, define it this way:

ssids[0]="Bhavik";
ssids[1]="iBall-Baton";

Then your code ought to work.

anonymous2
  • 155
  • 3
  • 11
0

I just noticed a remarkably simple issue: You forgot to swap out the line

#!/bin/sh

for the line

#!/bin/bash

This means that the script is using the sh coding rather than the powerloaded sh scripting called bash. Your array should work any way you define it if you have your script defined correctly.

anonymous2
  • 155
  • 3
  • 11