I'm trying to write a program that will get an object from github, without cloning the entire repo. The last line does not work, giving me
a Syntax error: "(" unexpected
. It is supposed to remove all files / directories except for that.
#!/bin/sh
object=$2 #sets item not to remove as second argument
address=$1 #sets github address (github.com/user/repo)
git clone $1 #clones it
location="${address##*/}" #gets part after last backslash
cd $location #cd's into it
#Syntax error: "(" unexpected
rm -rf !("$object")
bash
notsh
and enable them withshopt -s extglob