shell programming 1

1. Several Commands

wc: get a count of the total number of lines, words, characters contained in file.

Options:
	-l: to count the number of lines in a file
	-c: to count the number of characters in a file
    -w: to count the number of words in a file
ln: create duplicate name for a given file

Usages: ln from to

Options:
	-s: create a symbolic link points to original file; if the original file is removed, the symbolic link no longer works.
	* if a symbolic link doesn't work, which should be removed unless you have a specific reason to keep it around.

Points:
	ln files directory: you can create links to a bunch of files within a specific target directory using the format.

2. Standard Input/Output & I/O Redirection

symbolusage
[1]>override the destination file with standard ouputs
2>override the destination file with error outputs
&>override the destination file with standard & error outputs
>>append inputs at the end of destination file
<regard destination file as the part of command
<<define the end characters of file(eg. EOF)

3. Shell

I. Unix System: Kernal + Utilities
II. Command Execution Procedure
  1. search programs in specified PATH
  2. the shell creates a clone of itself(subshell)
  3. the shell asks the kernal to replace subshell
  4. the kernal copies programs into memroy
  5. start executing

4. Regular Expressions

  1. The caret(^): matching the beginning of the line
  2. The dollar sign($): matching the end of the line
  3. Other symbols:
symbolusage
*to match zero or more characters
?/.any single character
any character enclosed between the brackets
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值