鼠标粘贴复制没有权限linux,在终端中不使用鼠标复制和粘贴文本

NAME

co - a tool that helps you copy and paste text in your terminal when you

don't have access to a mouse or don't want to use one.

INSTALLATION

Installing co involves four steps. Some of these steps differ depending on

the interactive shell you use, but the concepts are the same. Don't forget

to substitute with the actual path to the co directory while following the

instructions.

Locating your shell initialization file

Refer to the manual corresponding to your interactive shell to locate

the path of the initialization script. Normally, zsh uses ~/.zshrc, fish

uses ~/.config/fish/config.fish and bash uses either ~/.bashrc,

~/.bash_profile, or ~/.profile.

Finding the co-hooks.* file corresponding to your interactive shell

There are three of these files in co/src. Here is a list of them and

their supported shells. Just keep note of the file compatible with your

shell.

co-hooks.sh: ash, bash, dash, ksh

co-hooks.zsh: zsh

co-hooks.fish: fish

If you use csh or tcsh, then you can skip this step because none of the

above files is compatible with them. This will disable some features

like automatically exported line and answer variables. Pull requests to

support these shells are welcome.

Configure the shell initialization file

Open your shell initialization script to

1) add the co command to your path

2) and source the suitable co-hooks.* file.

# sample bash configuration

export PATH="$PATH":/path/to/co/src

source co-hooks.sh

# sample zsh configuration

export PATH="$PATH":/path/to/co/src

source co-hooks.zsh

# sample fish configuration

set PATH $PATH /path/to/co/src

source /path/to/co/src/co-hooks.fish

# simple tcsh configuration (no co-hooks)

set path = ($path /path/to/co/src)

Restarting your terminal

The co command should be available once you restart your terminal.

EXAMPLE

Let's say you want to stage a modified file in a git repository you are

working on. You would normally type `git status`, use the mouse to select

the path of the file you want to stage, type "git add ", and then paste the

path of the file. You then hit enter and the file is staged.

co can help you achieve that without using a mouse. First, redirect the output

to co, and it will redirect it to you with the lines numbered.

$ git status | co

1On branch master

2Changes not staged for commit:

3 (use "git add ..." to update what will be committed)

4 (use "git checkout -- ..." to discard changes in working directory)

5

6modified: /very/long/path/to/file_v4521.cpp

7modified: /very/long/path/to/file_v552.cpp

8modified: /very/long/path/to/file_v952.cpp

9modified: /very/long/path/to/file_v552.cpp

10modified: /short/path/to/another_file.cpp

11

If you want to stage the third file, you can do it as following.

# you need to copy the 2nd word in the 8th line

$ co 8 2

/very/long/path/to/file_v952.cpp

# the previous output is now in $ans

$ git add $ans

There are a few other tricks to type even less than that, but this is a

quick example. Read the rest of the manual for more cool things.

DEFINITIONS

Buffer: the most recent stdin supplied to co.

For example, the buffer in the following case is the output of `ls`.

$ ls | co 7 1

If co is executed without stdin, the buffer will still contain the

contents of the last stdin supplied to it.

$ co 7 1

USAGE

co help

Display the manual (this page).

co clear

Clear the buffer and all the variables exported by co.

co

Display the buffer as a numbered listing.

co J

Print the Jth line in the buffer (without numbering, of course).

co J K

Print the Kth word in the Jth line in the buffer. If K is possitive, the

words are one-indexed. If it is negative, words are counted from the end

of the line.

co J:K

Print all the lines starting from the Jth line until the Kth line in the

buffer.

co J K:L

Print the Kth word, and all the text after it until the end of the Lth

word in the Jth line in the buffer.

VARIABLES

co sets some variables to reduce the amount of text you need to type.

The answer variables

By default, co sets a variable named ans to contain the last output

printed by the commands of the form "co J [K[:L]]". So both of the

following commands should print the same output.

$ ls -la | co 7 2

$ echo $ans

Older values of $ans will be available in $ans1, $ans2, and $ans9. The

number of stored answer variables is specified by the configuration as

will be shown in a subsequent section.

Line variables

By default, co sets a variable for every line of the first 50 lines in

the buffer. These variables are named l1, l2, l3, ... , and l50 (the

first character is a small L, not a capital i). So instead of typing

"$(co 7)", you can type "$l7". This, however, doesn't update the answer

variable.

CONFIGURATION

Configuration is read from ~/.co/conf. Settings are written in the form of

"key=value". Here is sample configuration which sets every variable to its

default.

# the maximum number of lines to be exported as variables

co_lines_max=50

# the prefix for line variables

co_lines_prefix=l

# the maximum number of answer variables to be saved

co_ans_max=10

# the name of the answer variable

co_ans_prefix=ans

# a string that will be printed before every even line

co_even_decoration="$(tput sgr0)"

# a string that will be printed before every odd line

co_odd_decoration="$(tput bold)"

# whether co_even_decoration and co_odd_decoration will be considered

co_decorate=1

# a string to be evaluated as a command by your interactive shell when

# the answer variable is changed. You can set this variable to paste

# answers into the system clipboard.

co_on_ans=""

#co_on_ans='echo "$ans" | xclip -sel clip'

ERROR HANDLING

When an error occurs, co exits with an error status and doesn't print

anything. This is intended to prevent the user from accidentally piping

irrelevant text to another tool.

MISC.

Sensitive data

Data piped to co is stored for later use in some files (located in

~/.co/) and is exported in some variables (like $ans, $l1, l2, etc...).

It's not advised to feed co with sensitive data. If you did, then as a

rudimentary security measure, consider issuing "co clear" erease the

buffer and the exported variables.

Catching stderr

The way to pipe the stderr of a command to co depends on the shell you

use. Bash users can use the |& construct, which pipes both stdout and

stderr.

$ gcc |& co

Navigation and search

You can use co within a pager. This can make navigation and searching

more convenient.

$ find . | co | less

System clipboard

Pasting to the clipboard depends on your system. For example, if you are

using the X windowing system (and you probably do), then you can use an

external tool like xclip to paste text to the system clipboard.

$ co 3 2 | xclip -sel clip

If typing "xclip -sel clip" is a lot of work, then consider creating an

alias for it.

HISTORY

2016 - Originally written by M. Helmy Hemeda.

《宾馆客房管理系统》是一个基于C#与MySQL的项目,旨在帮助学习者掌握数据库管理和系统开发知识。该项目通过完整代码实现,将编程技术应用于宾馆客房管理的实际业务场景。 C#是微软开发的面向对象编程语言,广泛用于Windows应用程序开发。在本项目中,C#用于构建用户界面、处理业务逻辑以及与数据库交互。它拥有丰富的类库,便于开发复杂图形用户界面(GUI),并通过ADO.NET组件实现与MySQL数据库的连接。MySQL是一种流行的开源关系型数据库管理系统(RDBMS),常用于Web应用程序,用于存储客房、预订、客户等核心数据。通过SQL语句,开发者可对数据进行增、删、改、查操作。系统中可能涉及“客房表”“预订表”“客户表”等,包含客房编号、类型、价格、预订日期等字段。 数据库连接是系统的关键部分。C#通过ADO.NET的SqlConnection类连接MySQL数据库,连接字符串包含服务器地址、数据库名称、用户名和密码。用户下载项目后,需根据本地环境修改连接字符串中的用户名和密码。系统主要功能模块包括:客房管理,可展示、添加、修改、删除客房信息;预订管理,处理预订的查看、新增、修改和取消;客户管理,存储和管理客户个人信息;查询功能,支持按客房类型、价格范围、预订日期等条件查询;报表和统计功能,生成入住率、收入统计等报表辅助决策。开发者需编写C#方法对应数据库操作,同时设计直观易用的界面,方便用户完成预订流程。项目中的MySQL文件可能是数据库脚本或配置文件,包含建表、数据填充及权限设置等内容,用户需在本地测试前运行脚本设置数据库环境。 总之,该系统结合C#和MySQL,为学习者提供了一个涵盖数据库设计、业务逻辑处理和界面开发的综合实践案例,有助于提升开发者在数据库应用和系统集成方面的能力。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值