Linux 中的 > 、 <

本文深入解析了重定向符的功能和用法,包括单大于号(&gt;)、双大于号(&gt;&gt;)及单小于号(&lt;)的作用。单大于号用于覆盖文件内容,双大于号用于追加内容至文件末尾,而单小于号则用于输入重定向。

单大于号

 > file

">" 单大于号,重定向符,没有命令在它之前,这会删除一个已存在文件的内容或是创建一个
新的空文件,作用是覆盖文件,将左侧的内容覆盖有右侧。上面命令由于左侧没有内容,因此将file清空了。如果有两个文件file1和file2,执行 cat file1 > file2,则将文件1的内容覆盖掉文件2的。因此">"左侧可以使用其它命令组合并将输出当做右侧文件的输入。

 

双大于号

file1 >> file2

用于覆盖,将左侧文件内容追加到右侧文件中。使用方式和单大于号相同。

 

单小于号

command < input

表示的是输入重定向的意思,就是把<后面跟的文件取代键盘作为新的输入设备。

<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> <PropertyGroup> <ProjectType>local</ProjectType> <ProjectVersion>7.10.377</ProjectVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{ADC5A455-0A27-4553-B7AA-BF869BCD8EB1}</ProjectGuid> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <AssemblyName>LinuxCmd</AssemblyName> <OutputType>WinExe</OutputType> <TargetFrameworkVersion>v2.0</TargetFrameworkVersion> <IsWebBootstrapper>false</IsWebBootstrapper> <PublishUrl>publish\</PublishUrl> <Install>true</Install> <InstallFrom>Disk</InstallFrom> <UpdateEnabled>false</UpdateEnabled> <UpdateMode>Foreground</UpdateMode> <UpdateInterval>7</UpdateInterval> <UpdateIntervalUnits>Days</UpdateIntervalUnits> <UpdatePeriodically>false</UpdatePeriodically> <UpdateRequired>false</UpdateRequired> <MapFileExtensions>true</MapFileExtensions> <ApplicationRevision>0</ApplicationRevision> <ApplicationVersion>1.0.0.%2a</ApplicationVersion> <UseApplicationTrust>false</UseApplicationTrust> <BootstrapperEnabled>true</BootstrapperEnabled> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <PlatformTarget>x86</PlatformTarget> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <PlatformTarget>x86</PlatformTarget> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> <PropertyGroup> <StartupObject>LinuxCmd.Program</StartupObject> </PropertyGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <ItemGroup> <Compile Include="Properties\Resources.Designer.cs"> <AutoGen>True</AutoGen> <DesignTime>True</DesignTime> <DependentUpon>Resources.resx</DependentUpon> </Compile> <EmbeddedResource Include="LinuxCmd\frMain.resx"> <DependentUpon>frMain.cs</DependentUpon> </EmbeddedResource> <EmbeddedResource Include="Properties\Resources.resx"> <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> </EmbeddedResource> <Reference Include="NAudio, Version=1.7.2.19, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>.\NAudio.dll</HintPath> </Reference> <Reference Include="SDK, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>.\SDK.dll</HintPath> </Reference> <Reference Include="System.Windows.Forms" /> <Reference Include="System" /> <Reference Include="System.Drawing" /> <Compile Include="AssemblyInfo.cs" /> <Compile Include="Global.cs" /> <Compile Include="LinuxCmd\LinuxEvent.cs" /> <Compile Include="LinuxCmd\BluetoothScanEvent.cs" /> <Compile Include="LinuxCmd\frMain.cs"> <SubType>Form</SubType> </Compile> <Compile Include="LinuxCmd\LinuxUdp.cs" /> <Compile Include="LinuxCmd\PlayController.cs" /> <Compile Include="LinuxCmd\Properties\Resources.cs" /> <Compile Include="LinuxCmd\DevItem.cs" /> <Compile Include="LinuxCmd\AudioEvent.cs" /> <Compile Include="LinuxCmd\RTPManager.cs" /> <Compile Include="LinuxCmd\WaveRecordDataHandler.cs" /> <Compile Include="LinuxCmd\RecordController.cs" /> <Compile Include="LinuxCmd\WaveRecorder.cs" /> <Compile Include="LinuxCmd\WaveErrorEventHandler.cs" /> <Compile Include="LinuxCmd\ATClient.cs" /> <Compile Include="LinuxCmd\LinuxSendSocket.cs" /> <Compile Include="LinuxCmd\Program.cs" /> <Compile Include="LinuxCmd\AudioManager.cs" /> <Compile Include="LinuxCmd\UdpBrocast.cs" /> <Compile Include="LinuxCmd\Properties\Settings.cs" /> <EmbeddedResource Include="LinuxCmd.Properties.Resources.resources" /> <EmbeddedResource Include="LinuxCmd.frMain.resources" /> </ItemGroup> <ItemGroup> <Content Include="LinuxCmd.ini"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> </ItemGroup> <ItemGroup> <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> <Visible>False</Visible> <ProductName>.NET Framework 3.5 SP1</ProductName> <Install>true</Install> </BootstrapperPackage> </ItemGroup> </Project>
最新发布
07-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值