`
textboy
  • 浏览: 20687 次
  • 性别: Icon_minigender_1
  • 来自: 广州
最近访客 更多访客>>
社区版块
存档分类
最新评论

CMD List [9]

F# 
阅读更多

1          Shell

1.1         variable ( $ )

System variable.

Option

Function

$abc

${abc}

abc = "blue"

echo ${abc}

$(command)

e.g. v1 = "$(hostname)", v2 = "$(pwd)"

$?

Expands to the exit status of the most recent pipeline. (last status code)

$n

$1 first argument, $2 second …

$#

Count of argument of command line

$0

Program name.

$*

Store all argument with “arg1 arg2 …”

$@

Store all argument with “arg1” “arg2” …

Note: If using in “…”, add {}, e.g. “… ${0} …”

 

User variable

e.g. name="Winter" echo $name

 

Environment variable

e.g. PATH, LOGNAME (logon user name)…

 

{}

Concatenate variable and string. E.g. SAT=Satur echo ${SAT}day

 

Unset

Clean variable. E.g. unset a

 

readonly

Content of variable can’t be changed. E.g. readonly a=2;unset a;echo “a=$a”;

 

array

e.g. name[0]=”a”;name[1]=”b”; echo ${name[$i]};

 

1.2         typeset

typeset [options] [variable[=value ...]]

 

Korn shell only. Assign a type to each variable. -option enables the type and +option disables it.

 

argument

Function

i

Integer, e.g. typeset -i n1 n2 n3

(nil)

Character, e.g. typeset sh_name

e.g.

typeset +r PWD End read-only status of PWD.

 

1.3         let

let expressions

     or

((expressions))

 

Korn shell only. Specified by one or more integer expressions which consist of numbers, operators, shell variables. Expressions must be quoted if they contain spaces.

e.g.

i=`expr $i + 1`

let i=i+1

let "i = i + 1"

(( i = i + 1 ))

let $a + $b

 

1.4         Control Statement

while [condition]  (or [[ … ]])

do

   

done (or done < InputFile)

 

for string in list

do

   

done

 

if / elif [condition] (or [[ … ]])

then

   

(else)

   

fi

 

 

Operation in control statement

Operator

[[ ]]

 

-a file

-d file

-e file

-f file

-r file

-s file

-w file

-x file

 

-O file

-G file

1 -nt 2

1 -ot 2

 

-lt

 

!=, >, <

-n str

-z str

 

&&,||,-a,-o

True if...

It is better integrated into the Korn shell, it provides many options to check different attributes of a file, returns an exit status.

True if the file exists.

file is a directory

True if the file exists.

file is a regular file (i.e., not a directory or other special type of file)

You have read permission on file

file exists and is not empty

You have write permission on file

You have execute permission on file, or directory search permission if it is a directory

You own file

Your group ID is the same as that of file

file1 is newer than file2

file1 is older than file2

 

Less than (other like -le, -eq, -ge, -gt, -ne)

 

Normal compare.

Str is not null (length greater than 0).

Str is null (length is 0).

 

Seems same as and (&&) or (||).

 

Other

break

Exit from a while or for loop.

continue

Begin next iteration of while or for loop without reaching the bottom.

exit

Do not execute remaining instruction and read no new input. END procedures will be executed.

return [expr]

For nawk. Used at end of user-defined functions to exit function, returning value of expression.

 

e.g.

if [[ -f "$ldcmd" ]]

then

       while read LINE

       do

             

       Done < ${ldcmd}

fi

rc=$?

return ${rc}

 

if command && [[ condition_1 || condition_2 ]]; then …

while [ $hour -le 0030 -o $hour -ge 2200 ]

 

1.5         Function

function  function_name () {commands; commands; }

unset -f function_name

 

1.6         Concatenate

Ø      Break line: ( backslash \ )

Ø      Concatenate string: ( blank )

分享到:
评论

相关推荐

    CMDCMD命令CMD命令

    14. `tlist` 和 `kill`:这两个命令是用于查看和结束进程的,通常在系统调试和故障排除中使用。 15. `del` 和 `move`:文件管理命令,`del`用于删除文件,`/S /Q`选项可以递归删除目录及其内容而不提示,`move`用于...

    隐藏CMD黑窗(脚本)

    隐藏 CMD 黑窗口的脚本通常用于在运行批处理文件或其他命令行程序时,避免显示命令提示符窗口,这样可以让用户在后台执行脚本而不会干扰到其他任务。 该文件需配合BAT脚本使用,在.vbs中将路径指向BAT脚本并运行该...

    cmd管道技术向cmd发送字符

    如`dir /b | sort &gt; list.txt` 会排序目录中的文件并保存到`list.txt`,然后可以使用`fc /l list.txt list_sorted.txt` 比较排序前后的差异。 3. **统计分析**:`find`命令可以计数特定字符或字符串。如`type file....

    java javascript 调用命令行 cmd

    List&lt;String&gt; commands = Arrays.asList("cmd", "/c", "dir"); ProcessBuilder pb = new ProcessBuilder(commands); Process process = pb.start(); ``` **JavaScript调用命令行** 在JavaScript中,由于安全...

    sqlcmd 参数详解

    * -L [ c ] list servers [ clean output ]:列出服务器。 * -p [ 1 ] print statistics [ colon format ]:打印统计信息。 * -X [ 1 ]:禁用命令、启动脚本和环境变量。 * -? show syntax summary:显示语法摘要。 ...

    CMD网络命令大全123

    ##### 9. **`net send`** - **向其他计算机发送消息**: ```cmd net send IP 文本信息 ``` 向指定IP地址的计算机发送文本消息。 ##### 10. **`net ver`** - **查看局域网内的网络连接类型和信息**: ```...

    Qt调用CMD启动外部程序Demo.zip

    在压缩包内的`Test-cmd`和`build-Test-cmd-Desktop_Qt_5_9_3_MSVC2015_64bit-Debug`文件夹中,`Test-cmd`很可能是源代码目录,包含Qt项目的主文件和相关源码,而`build-...`目录是使用CMake构建生成的临时目录,包含...

    qt调用cmd命令和dll例子

    process.start("cmd.exe", QStringList() ); process.waitForFinished(); ``` 这里的`start`方法启动了CMD进程,并通过`/c`参数传递了执行"dir"命令的指令。`waitForFinished`确保我们等待命令执行完成后再继续执行...

    linux 离线安装perl-IPC-Cmd

    6. `perl-Module-CoreList-2.76.02-299.el7_9.noarch.rpm`: 显示Perl核心模块的版本信息,帮助确定哪些模块已经包含在当前Perl版本中。 7. `perl-version-0.99.07-6.el7.x86_64.rpm`: 为Perl处理版本号提供支持,...

    cmd中的重定向输出,管道

    ### CMD中的重定向输出与管道操作详解 在日常的编程工作中,特别是在Windows环境下进行开发时,熟练掌握CMD命令行工具的使用技巧对于提高工作效率是非常有帮助的。本文将重点介绍CMD中的重定向输出(`&gt;`、`&gt;&gt;`)...

    静态编译的trace-cmd,x86版本,v3.1.4

    2. **事件选择**: `trace-cmd list`可以列出所有可用的内核事件,用户可以根据需求选择要追踪的事件。 3. **查看日志**: `trace-cmd report`命令将追踪数据转化为可读的报告,帮助分析系统行为。 4. **保存/加载**...

    C# 传入自定义列表List 到Oracle存储过程

    cmd.Parameters.Add(new OracleParameter("p_list", oraArray)); cmd.ExecuteNonQuery(); ``` 5. **关闭连接**: 执行完存储过程后,别忘了关闭数据库连接。 通过这种方式,C#中的自定义列表(List)可以高效地...

    遍历CheckBoxList,获得选中项的值动态绑定CheckBoxList代码

    ### 遍历CheckBoxList,获得选中项的值动态绑定CheckBoxList #### 知识点一:CheckBoxList概述及应用场景 **CheckBoxList** 是ASP.NET Web Forms中一个非常有用的控件,它允许用户选择一个或多个选项。CheckBoxList...

    常用的一些cmd命令

    - `tlist`:显示系统中的进程。 - `kill`:结束进程。 - `route print`:显示路由表。 这些CMD命令涵盖了从基础的文件操作到复杂的网络管理,是IT专业人员必备的技能之一。熟练掌握它们,可以极大地提高工作效率...

    java调用cmd创建目录和复制文件

    在Java编程中,有时我们需要执行一些系统级别的操作,如创建目录、复制文件等,这些操作在Windows系统中可以通过命令行接口(CMD)来完成。Java提供了Runtime类和ProcessBuilder类来实现这样的功能,允许我们调用...

    Linux系统firewall-cmd 命令详解.docx

    * firewall-cmd --zone=dmz --list-ports 这将显示 dmz zone 中所有打开的端口。 firewall-cmd 命令还可以用于添加端口到 zone,例如: * firewall-cmd --zone=dmz --add-port=8080/tcp 这将添加 8080 端口到 ...

    CMD命令(自己的收藏啊)

    16. `tlist -t`和`kill -F`: 分别用于列出和结束进程,通常在Support Tools中。 17. `del`和`rmdir`: 用于删除文件和目录,`-F`选项可删除只读文件,`/S`和`/Q`分别用于删除目录及其内容,且不提示确认。 18. `...

    CMD快速操作

    - `tlist -t`:列出系统进程(需额外安装工具)。 - `kill -F`:强制结束进程(同样需要额外安装工具)。 掌握这些CMD命令,可以帮助用户高效地进行系统管理和网络操作,尤其是在没有图形用户界面的情况下。了解...

Global site tag (gtag.js) - Google Analytics