Bad substitution error when using bash -
this question has answer here:
so wanted bash script whenever run "bad substitution" error. have browsed stackoverflow , tried solutions none worked :/ ideas?
#!/bin/bash printf "hello. ots setup script provided damon @ otland. please standby user input may required." read -r -p "do want install webpanel? [y/n]" response response=${response,,} # tolower if [[ $response =~ ^(yes|y| ) ]]; wget https://raw.githubusercontent.com/nicolasloew/vps/master/panelsetup.sh sh panelsetup.sh fi printf "if installed webpanel please navigate http://yourip:2004/ , follow install instructions." printf "once have installed webpanel login , go enduser-->configuration-->apache , delete in config , replace https://raw.githubusercontent.com/nicolasloew/vps/master/apacheconfig. needed znote later." read -r -p "do want compile latest tfs? [y/n]" response response=${response,,} # tolower if [[ $response =~ ^(yes|y| ) ]]; wget https://raw.githubusercontent.com/nicolasloew/vps/master/tfsauto.sh sh tfsauto.sh fi printf "you have compiled tfs! can start going cd forgottenserver , execute ./tfs. dont forget configure config.lua though. can create database in webpanel-->enduser." read -r -p "do want install znoteaac? [y/n]" response response=${response,,} # tolower if [[ $response =~ ^(yes|y| ) ]]; wget https://raw.githubusercontent.com/nicolasloew/vps/master/znotesetup.sh sh znotesetup.sh fi printf "you havee setup znoteaac. navigate http://yourip , follow instructions."
edit comments
the edit invoked as
sh otsetup.sh
you invoking script sh
, not bash
.
the parameter substitution using put string lowercase
response=${response,,} # lower
is available using bash version 4.0
so either call script modern bash or use syntax not bash-dependant.
for example
response=$(echo "$response" | tr '[:upper:]' '[:lower:]')
Comments
Post a Comment