I've been working on a script that automates setting up a development environment for Raspberry Pi development (step by step details that work are here). The script is linked in that article but convenience you can find it here also. Now when run this script install and sets up the environment without error but you have to enter your sudo password more than once due to sudo's time-out value by default. So I started experimenting by removing all the sudo lines and running the whole script via sudo at the command line like so:
kemra102@ubuntuvm:~$ sudo ./pi_dev_env_install.sh
This works fine as expected and gets most of the way through until this point:
./pi_dev_env_install: 68: ./pi_dev_env_install.sh: Syntax error: "(" unexpected
Now this line worked fine previously when not running the whole script with sudo. There is nothing about this line running as sudo that should stop it working to my knowledge, does anyone have any ideas?