The K Shell Program Guide(1)

MySQL rand()函数、rand(n)、生成不重复随机数 rand()函数每次生成是随机数都是不一致且不重复的。适用场景:样本抽样,对数据随机排序后获取前x条。每次排序的结果都是随机的、不一致的。rand(n:int)函数n是个int类型的种子参数,每个种子生成的随机数都是不同的。但是相同的种子每次返回的随机数都是固定的。如rand(2)每次返回的值是固定的。同一次查询时结果集中可能会产生重复的数字。多次查询时每次返回的随机数与上一次查询结果一致。适用场景:用于需要重复生成相同随机数序列的场景,例如模拟实验或测试中需要重复执行相同的随机操作。 阅读详情
1)
WildcardMatches
?Any single character
*Any string of characters
[set]Any character in set
[!set]Any character not in set
2)
ExpressionMatches
[abc]a, b, or c
[.,;]Period, comma, or semicolon
[-_]Dash and underscore
[a-c]a, b, or c
[a-z]All lowercase letters
[!0-9]All non-digits
[0-9!]All digits and exclamation point
[a-zA-Z]All lower- and uppercase letters
[a-zA-Z0-9_-]All letters, all digits, underscore, and dash
3)
UtilityPurpose
catCopy input to output
grepSearch for strings in the input
sortSort lines in the input
cutExtract columns from input
sedPerform editing operations on input
trTranslate characters in the input to other characters
4)
fc -l
fc -e - number
5)
user's environment file is .profile.
6)Built-in Commands and Keywords

Here is a summary of all built-in commands and keywords.

CommandChapterSummary
:7Do nothing (just do expansions of arguments).
.4Read file and execute its contents in current shell.
alias3Set up shorthand for command or command line.
bg8Put job in background.
break5

Exit from surrounding for, select, while, or until loop.

case5Multi-way conditional construct.
cd1Change working directory.
continue

Skip to next iteration of for, select, while, or until loop.

echo4Expand and print arguments (obsolete).
exec9Replace shell with given program.
exit5Exit from shell.
export3Create environment variables.
eval7Process arguments as a command line.
fc2Fix command (edit history file).
fg8Put background job in foreground.
for5Looping construct.
function4Define function.
getopts6Process command-line options.
if5Conditional construct.
jobs1List background jobs.
kill8Send signal to process.
let6Arithmetic variable assignment.
newgrpStart new shell with new group ID.
print1Expand and print arguments on standard output.
pwd1Print working directory.
read7Read a line from standard input.
readonly6Make variables read-only (unassignable).
return5Return from surrounding function or script.
select5Menu generation construct.
set3Set options.
shift6Shift command-line arguments.
timeRun command and print execution times.
trap8Set up signal-catching routine.
typeset6Set special characteristics of variables.
ulimit10Set/show process resource limits.
umask10Set/show file permission mask.
unalias3Remove alias definitions.
unset3Remove definitions of variables or functions.
until5Looping construct.
wait8Wait for background job(s) to finish.
whence3Identify source of command.
while5Looping construct.
7)
Built-in Shell Variables

VariableChapterMeaning
#4Number of arguments given to current process.
-Options given to shell on invocation.
?5Exit status of previous command.
$8Process ID of shell process.
_Last argument to previous command.
!8Process ID of last background command.
CDPATH3List of directories for cd command to search.
COLUMNS3

Width of display in columns (for editing modes and select).

EDITOR2

Used to set editing mode; also used by mail and other programs.

ERRNOAError number of last system call that failed.
ENV3

Name of file to run as environment file when shell is invoked.

FCEDIT2Default editor for fc command.
FPATH4Search path for autoloaded functions.
IFS7

Internal field separator: list of characters that act as word separators. Normally set to SPACE, TAB, and NEWLINE.

HISTFILE2Name of command history file.
HISTSIZE2Number of lines kept in history file.
HOME3Home (login) directory.
LINENO9Number of line in script or function that just ran.
LINES3Height of display in lines (for select command).
MAIL3Name of file to check for new mail.
MAILCHECK3How often (in seconds) to check for new mail.
MAILPATH3

List of file names to check for new mail, if MAIL is not set.

OLDPWD3Previous working directory.
OPTARG6Argument to option being processed by getopts.
OPTIND6Number of first argument after options.
PATH3Search path for commands.
PS13Primary command prompt string.
PS23Prompt string for line continuations.
PS35Prompt string for select command.
PS49Prompt string for xtrace option.
PPID8Process ID of parent process.
PWD3Current working directory.
RANDOM9

Random number between 0 and 32767 (2215-1).

REPLY5,7

User's response to select command; result of read command if no variable names given.

SECONDS3Number of seconds since shell was invoked.
SHELL3Full pathname of shell.
TMOUT10

If set to a positive integer, number of seconds between commands after which shell automatically terminates.

VISUAL2Used to set editing mode.
8)Test Operators

These are the operators that are used with the [[...]] construct. They can be logically combined with && ("and") and || ("or") and grouped with parenthesis.

OperatorTrue If...
-a filefile exists.
-b filefile is a block device file.
-c filefile is a character device file.
-d filefile is a directory.
-f filefile is a regular file.
-g filefile has its setgid bit set.
-k filefile has its sticky bit set.
-n stringstring is non-null.
-o optionoption is set.
-p filefile is a pipe or named pipe (FIFO file).
-r filefile is readable.
-s filefile is not empty.
-t NFile descriptor N points to a terminal.
-u filefile has its setuid bit set.
-w filefile is writeable.
-x file

file is executable, or file is a directory that can be searched.

-z stringstring is null.
-G filefile's group ID is the same as that of the shell.
-L filefile is a symbolic link.
-O filefile is owned by the shell's user ID.
-S filefile is a socket.
fileA -nt fileBfileA is newer than fileB.
fileA -ot fileBfileA is older than fileB.
fileA -ef fileB

fileA and fileB point to the same file.

string = pattern

string matches pattern (which can contain wildcards).

string != patternstring does not match pattern.
stringA < stringB

stringA comes before stringB in dictionary order.

stringA > stringB

stringA comes after stringB in dictionary order.

exprA -eq exprB

Arithmetic expressions exprA and exprB are equal.

exprA -ne exprB

Arithmetic expressions exprA and exprB are not equal.

exprA -lt exprBexprA is less than exprB.
exprA -gt exprBexprA is greater than exprB.
exprA -le exprBexprA is less than or equal to exprB.
exprA -ge exprBexprA is greater than or equal to exprB.
9)Typeset Options

These are arguments to the typeset command.

OptionMeaning
With no option, create local variable within function.
-LLeft justify and remove leading blanks.
-RRight justify and remove trailing blanks.
-fWith no arguments, prints all function definitions.
-f fnamePrints the definition of function fname.
+fPrints all function names.
-ftTurns on trace mode for named function(s).
+ftTurns off trace mode for named function(s).
-fuDefines given name(s) as autoloaded function(s).
-iDeclare variable as an integer.
-lConvert all letters to lowercase.
-rMake variable read-only.
-uConvert all letters to uppercase.
-x

Export variable, i.e., put in environment so that it is passed to subshells

10)
Substitution Operators
OperatorSubstitution
${varname:-word}

If varname exists and isn't null, return its value; otherwise return word.

Purpose:

Returning a default value if the variable is undefined.

Example:

${count:-0} evaluates to 0 if count is undefined.

${varname:=word}

If varname exists and isn't null, return its value; otherwise set it to word and then return its value.[7]

Purpose:

Setting a variable to a default value if it is undefined.

Example:

${count:=0} sets count to 0 if it is undefined.

${varname:?message}

If varname exists and isn't null, return its value; otherwise print varname: followed by message, and abort the current command or script. Omitting message produces the default message parameter null or not set.

Purpose:

Catching errors that result from variables being undefined.

Example:

{count:?" undefined!" } prints "count: undefined!" and exits if count is undefined.

${varname:+word}

If varname exists and isn't null, return word; otherwise return null.

Purpose:

Testing for the existence of a variable.

Example:

${count:+1} returns 1 (which could mean "true") if count is defined.

【Linux】【shell】常用命令全称 Shell 命令全称与含义详解 阅读详情

相关推荐

让 ABAP 开发者也能做出高质量 SAP Fiori:到底需要掌握多少前端知识?

文章摘要: 随着SAP技术演进,ABAP开发者的角色边界正在重构。传统SAP GUI时代的全栈开发模式逐渐转向RAP+Fiori Elements的新范式,其中关键技术变化包括: 开发模式转变:从前后端耦合转向RAP模型驱动开发,通过CDS注解实现UI意图表达 分工优化:Fiori Elements模板处理80%标准UI需求,Flexible Programming Model解决20%差异化需求 效率提升:注解驱动开发可在RAP建模阶段同步定义UI结构,大幅缩短交付周期 工具整合:SAP提供从建模到部署的

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 308

RAND_MAX的使用及rand()函数使用

rand()不需要参数,它会返回一个从0到最大随机数的任意整数,最大随机数的大小通常是固定的一个大整数,一般为0x7fff; rand()范围是[0,RAND_MAX] 如果说是 10rand(),则对应的范围应该为[0.0,10RAND_MAX] rand()/RAND_MAX 对应的范围是 [0.0 , 1.0) rand()/(RAND_MAX + 1.0) 对应范围是 [0....

qq_42681507的博客 2万+

地平线旭日X5开发板--搭建ROS1环境开发

由于RDK X5是基于Ubuntu22.04 进行版本释放,而ROS1只兼容到了20.04,为了更很好的做以前ROS1相关代码方案的快速迁移,提供了使用docker 的ros环境,进而使用ros1的方案。

bingdund的博客 993

C语言——rand函数

这是一个在 C 标准库中定义的函数,用于生成伪随机数,默认情况下,它生成从 0 到RAND_MAX的伪随机数,其中RAND_MAX是一个常数,通常是32767。返回产生的从 0 到RAND_MAX的伪随机数。在使用 rand 函数时要配合 srand 函数设置 rand 函数的随机种子。

Stewie Lee的博客 2万+

C++ rand的用法

这里写目录标题rand()介绍srand()介绍产生随机数的用法产生一定范围随机数的通用表示公式 我们知道 rand() 函数可以用来产生随机数,但是这不是真正意义上的随机数,是一个伪随机数,是根据一个数(我们可以称它为种子)为基准以某个递推公式推算出来的一系列数,当这系列数很大的时候,就符合正态公布,从而相当于产生了随机数,但这不是真正的随机数,当计算机正常开机后,这个种子的值是定了的,除非你破坏了系统。 rand()介绍 功能: 随机数发生器 用法: int rand(void) 所在头文件: stdl

TABE_的博客 8897

AWK 介绍

AWK 介绍 如果要格式化报文或从一个大的文本文件中抽取数据包,那么a w k可以完成这些任务。它 在文本浏览和数据的熟练使用上性能优异。 整体来说, a w k是所有s h e l l过滤工具中最难掌握的,不知道为什么,也许是其复杂的语法 或含义不明确的错误提示信息。在学习a w k语言过程中,就会慢慢掌握诸如Bailing out 和 a w k : c m d . L i n e :等错误信

symield的专栏 3043

regular expression

//simple and useful.^         :begainning of a line.           :/^love/$         :end of a line.           :/love$/;/^$/.          :matches one character.           :/l..e/*         :mat

symield的专栏 1213

ex

not null.

symield的专栏 991

grep

1)$ grep -n ^south datafile    3:southwest    SW      Lewis Dalsass          2.72)$ grep -i pat datafile      Pat     Huang                  yuanxiao    ps: The -i option turns off case se

symield的专栏 944

sed, a Streamlined Editor.

preface:Sed is a streamlined noninteractive editor.It can edit a file or data, and it just modify the output, but not modify the originally files.Format of sed: $sed command filename.Command Fun

symield的专栏 931

The first article of shell.

This Days, i will post some articles for shell tools, as awk... sort... wc... tr... sed... I want to make a db of shells utility tools!And the data are from some books and websites, and every rig

symield的专栏 890

split

s p l i t命令一般格式:split -output_file-size input-filename output-filename这里o u t p u t - f i l e - s i z e指的是文本文件被分割的行数。s p l i t查看文件时,o u t p u t - f i l e - s i z e选项指定将文件按每个最多1 0 0 0行分割。如果有个文件有2 8 0 0

symield的专栏 883

awk:the most powerful utility tool in shell world.

1)   FORMAT:   awk pattern filename                          awk {action} filename                          awk  pattern {action} filename(a)  awk /Sally/ {print $1} filename(b)  ls -l |awk $1

symield的专栏 883

join

其一般格式为:join [options] input-file1 input-file2an n 为一数字,用于连接时从文件n中显示不匹配行。例如, - a 1显示第一个文件的不匹配行,- a 2为从第二个文件中显示不匹配行。o n.m n为文件号,m为域号。1 . 3表示只显示文件1第三域,每个n,m必须用逗号分隔,如1 . 3,2 . 1。j n m n为文件号,m为域号。使用其他域

symield的专栏 853

sort

s o r t命令的一般格式为:sort -cmu -o output_file [other options] +pos1 +pos2 input_files下面简要介绍一下s o r t的参数:-c 测试文件是否已经分类。-m 合并两个分类文件。-u 删除所有复制行。-o 存储s o r t结果的输出文件名。其他选项有:-b 使用域进行分类时,忽略第一个空格。-n 指定分类是域上的数字分类

symield的专栏 842

cut

cut [options] file1 file2下面介绍其可用选项:-c list 指定剪切字符数。-f field 指定剪切域数。-d 指定与空格和t a b键不同的域分隔符。- c用来指定剪切范围,如下所示:- c 1,5-7 剪切第1个字符,然后是第5到第7个字符。-c1-50 剪切前5 0个字符。-f 格式与- c相同。-f 1,5 剪切第1域,第5域。- f 110-12 剪切第1

symield的专栏 833

uniq

命令一般格式:uniq -u d c -f inputfile outputfile其选项含义:-u 只显示不重复行。-d 只显示有重复数据行,每种重复行只显示其中一行-c 打印每一重复行出现次数。-f n为数字,前n个域被忽略。一些系统不识别- f选项,这时替代使用- n。

symield的专栏 809

飞凌嵌入式ElfBoard-Shell常用工具和命令-sleep命令

sleep命令在Linux中用于创建一个虚拟的工作,这个工作可以帮助我们延迟执行。它默认以秒为单位接受时间,但是也可以通过在末尾添加一个小后缀(s, m, h, d)来将其转换为任何其他格式。当用户在 Linux 中发出多个命令序列时,命令会立即一个接一个或同时执行(例如,tee 命令)。但是,有时需要推迟命令的执行并为系统提供足够的时间来产生预期的结果。其中sleep后面的时间可以根据实际情况来改变,1就是间隔1s,改的数字越小,进度条越快,反之越慢。sleep命令主要接受一个参数,即延迟的时间。

2301_76587520的博客 194

螺旋桨参数化.zip

1.版本:matlab2014a/2019b/2024b2.附赠案例数据可直接运行。3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。

上一篇: java servlet specification v2.2
下一篇: A simply server code with c.
symield
博客等级 码龄22年 0粉丝 29原创
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值