我很想用Line 2: ambiguous redirect and Line 14: unary operator expected.
编写代码。
这是我的代码:
JSONObject json = new JSONObject(response.body().toString());
Log.i(LOG_TAG, json.getString("axe1"));
这是我的错误:
using Akka;
using Akka.Actor;
using Akka.TestKit;
using Akka.TestKit.Xunit;
using System.Diagnostics;
using Xunit;
class MyFsm : FSM<MyFsm.State, MyFsm.Data>
{
public MyFsm()
{
StartWith(State.Idle, new Data());
When(State.Idle, state =>
{
var eventWasHandled = state.FsmEvent.Match()
.With<MessageA>(message => { return; })
.WasHandled;
if (eventWasHandled)
{
Debug.WriteLine($"{State.Idle} => transitioning to {State.Busy}");
return GoTo(State.Busy);
}
else
{
Debug.WriteLine($"{State.Idle} => returning null");
return null;
}
});
When(State.Busy, state =>
{
var eventWasHandled = state.FsmEvent.Match()
.With<MessageB>(message => { return; })
.WasHandled;
if (eventWasHandled)
{
Debug.WriteLine($"{State.Busy} => transitioning to {State.Done}");
return GoTo(State.Done);
}
else
{
Debug.WriteLine($"{State.Busy} => returning null");
return null;
}
});
Initialize();
}
public enum State { Idle, Busy, Done }
public class Data { }
}
class MessageA { }
class MessageB { }
public class MyFsmTests : TestKit
{
[Fact]
public void Its_initial_state_is_Idle()
{
var myFsm = new TestFSMRef<MyFsm, MyFsm.State, MyFsm.Data>(Sys, Props.Create<MyFsm>());
Assert.Equal(MyFsm.State.Idle, myFsm.StateName);
}
[Fact]
public void It_transitions_to_the_Busy_state_after_receiving_MessageA()
{
var myFsm = new TestFSMRef<MyFsm, MyFsm.State, MyFsm.Data>(Sys, Props.Create<MyFsm>());
myFsm.SetState(MyFsm.State.Idle);
myFsm.Tell(new MessageA());
Assert.Equal(MyFsm.State.Busy, myFsm.StateName);
}
[Fact]
public void It_transitions_to_the_Done_state_after_receiving_MessageB_using_SetState()
{
var myFsm = new TestFSMRef<MyFsm, MyFsm.State, MyFsm.Data>(Sys, Props.Create<MyFsm>());
myFsm.SetState(MyFsm.State.Busy);
myFsm.Tell(new MessageB());
Assert.Equal(MyFsm.State.Done, myFsm.StateName);
}
[Fact]
public void It_transitions_to_the_Done_state_after_receiving_MessageB_without_using_SetState()
{
var myFsm = new TestFSMRef<MyFsm, MyFsm.State, MyFsm.Data>(Sys, Props.Create<MyFsm>());
myFsm.Tell(new MessageA());
myFsm.Tell(new MessageB());
Assert.Equal(MyFsm.State.Done, myFsm.StateName);
}
}
有人能帮助我理解为什么会出现这个错误吗?
答案 0 :(得分:1)
正如@GlennJackman指出的那样,这些行与代码不匹配,因此我猜测如下:
truncate -s0 $2
;
fi
尝试以下方法:
#!/bin/bash
echo -n "Output to $2 "
# set counter
count=1
# zap output file
truncate -s0 $2
# Loop
while [ $count -le $1 ]
do
# generate some random text
randomnumber=`od -A n -t d -N 1 /dev/urandom`
randomtext=`cat /dev/urandom | tr -cd "[:alnum:]" | head -c $randomnumber`
# generate a random number
randomnumber=`od -A n -t d -N 1 /dev/urandom`
# output to file
echo "$count,$randomtext,$randomnumber" | sed -e "s: *::g" >> $2
# increment counter
count=$(($count + 1))
if [ $(($count % 500)) -eq 0 ]
then
echo -n "."
fi
done
echo " Output complete"