小编Rec*_*ion的帖子

无法理解简单的shell脚本

我很久没有使用过shell脚本了.我在网上寻求帮助,但没有找到足够的指南..

这是我想要了解的代码:

#!/bin/sh
# -*-sh-*-
if gcc $1 &> cmp_out; then
    if ! ./a.out &> run_out; then
        exit 0;                 # Success.
    fi
fi
exit 1;                         # Failure.
Run Code Online (Sandbox Code Playgroud)

什么是cmp_out和run_out?这些是std_out吗?

我知道&>是一个重定向指令.但是我没有在这个脚本语法中得到什么意思.

我正在寻找这个脚本正在做什么的高级概述.如果您需要有关我使用此脚本的原因的更多信息,请通知我.我将详细介绍原因.

简而言之,它是delta调试的一个包含示例(//www.st.cs.uni-saarland.de/dd/)

linux debugging shell gcc

9
推荐指数
1
解决办法
1142
查看次数

出于某种原因,不能将XOR运算符与两个char一起使用,有人知道为什么?

是否有一些正式标准不允许人们在C#中使用具有两个字符的^或XOR函数?

    public char[] XORinput(char[] input, char SN)
    {
        int InputSize = input.Length;
        //initialize an output array
        char[] output = new char[InputSize];

        for (int i = 0; i < InputSize; i++)
        {

            output[i] = input[i] ^ SN;

        }


        return output;

    }
Run Code Online (Sandbox Code Playgroud)

无论出于何种原因,此代码都给我这个错误,错误1400无法将类型'int'隐式转换为'char'.存在显式转换(您是否错过了演员?)

这没有任何意义.

呼叫者:

                string num = "12345";
                char SN = Convert.ToChar(num);//serial number

                string sCommand = ("Hellow");

                char[] out = new char[sCommand.ToCharArray().Length];


                out = calculator.XORinput(sCommand.ToCharArray(), SN);
Run Code Online (Sandbox Code Playgroud)

c# operators

3
推荐指数
1
解决办法
4165
查看次数

标签 统计

c# ×1

debugging ×1

gcc ×1

linux ×1

operators ×1

shell ×1