static Action lastAction = null;
static void AnyAction()
{
Console.WriteLine("Выполняю какое-то действие. Не отключайтесь...");
Thread.Sleep(3000);
}
static void Repeat()
{
Console.WriteLine("Хотите повторить? [Д/н]");
if (char.ToUpper(Console.ReadKey().KeyChar) == 'Д')
{
Console.WriteLine();
lastAction();
Repeat();
}
}
static void Main(string[] args)
{
lastAction = AnyAction;
lastAction();
Repeat();
}
static Queue<Action> actions = new Queue<Action>();
static void AnyAction()
{
Console.WriteLine("Выполняю какое-то действие. Не отключайтесь...");
Thread.Sleep(3000);
}
static void Main(string[] args)
{
actions.Enqueue(AnyAction);
while (actions.Count > 0)
{
actions.Dequeue()();
Console.WriteLine("Хотите повторить? [Д/н]");
if (char.ToUpper(Console.ReadKey().KeyChar) == 'Д')
{
Console.WriteLine();
actions.Enqueue(AnyAction);
}
}
}
sed ':a;N;$!ba;s/""/"world"/2'
echo "hello: \"\"
hello: \"\"
hello: \"\"" | sed ':a;N;$!ba;s/""/"world"/2'
sed '2s/""/"world"/1'