어떤 이유로 든 나를 위해 작동하지 않는 for bash for loop 변수를 설정해야합니다. 당신이 볼 수 있듯이루프 용 bash 내부에서 변수를 설정하는 방법은 무엇입니까?
function unlockBoxAll
{
appdir=$(grep -i "CutTheRope.app" /tmp/App_list.tmp)
for lvl in {0..24}
key="UNLOCKED_$box_$lvl"
plutil -key "$key" -value "1" "$appdir/../Library/Preferences/com.chillingo.cuttherope.plist" 2>&1> /dev/null
successCheck=$(plutil -key "$key" "$appdir/../Library/Preferences/com.chillingo.cuttherope.plist")
if [ "$successCheck" -eq "1" ]; then
echo "Success! "
else
echo "Failed: Key is $successCheck "
fi
done
}
, 내가 가진 루프 내부 변수에 작성하려고 :
key="UNLOCKED_$box_$lvl"
하지만 그렇게 할 때, 나는이 얻을 : 여기 내 스크립트의 발췌입니다
/usr/bin/cutTheRope.sh: line 23: syntax error near unexpected token `key="UNLOCKED_$box_$lvl"'
/usr/bin/cutTheRope.sh: line 23: `key="UNLOCKED_$box_$lvl"'
내가 옳지 않은 행동은 무엇입니까? 이것을 할 또 다른 방법이 있습니까?
감사합니다.
Doh! 나는 정말 바보 야! 롤 : P 정말 고마워요! –