这有什么问题?我似乎无法为$ SITE var指定任何内容。 “rm”也不起作用。我连接命令和var错了吗?
newsite () {
local SITE = $1;
if [ -z "$1" ]; then # Is parameter #1 zero length?
echo 'Please give the site a name'
read = SITENAME;
$SITE = $SITENAME
fi
git clone git://mydomain/site_template.git $SITE
echo "New site has been created called: \"$SITE\"."
rm -rf $SITE"/.git";
rm $SITE"/README.txt";
return 0
}
答案 0 :(得分:1)
照顾空白:
local SITE=$1
也:
read SITENAME
和
SITE=$SITENAME
答案 1 :(得分:0)
function newsite {
SITE=$1;
if [ -z "$1" ]
then
echo 'Please give the site a name';
read = SITENAME;
$SITE = $SITENAME;
fi
git clone git://mydomain/site_template.git $SITE
echo "New site has been created called: \"$SITE\"."
rm -rf $SITE"/.git";
rm $SITE"/README.txt";
return 0
}