读书笔记 - 《Advanced Bash-Scripting Guide》

 

 

Part 1

It is a weired book that it has no the part one but part two. 

 

Part 2. Basics

Yes, very basic, if you can't master all of them, please don't get forward. Read it again and again until you can do every example without the book.

 

Part 3. Beyong the Basics

No, it is not beyong the basics, it is still basic knowledge. Read it again and agian. This is my tricky to learn programming. 

 

Part 4. Commands

haha, wolderful thing begins here.

......

Need more practice over these commands.

 

Part 5. Advanced Topics

There are a lot of interesting topics in this part. I read all of them and understand them. But I think I can't remeber them clearlly in the future.

IO Redirection - File Descriptor

LOGFILE=logfile.txt

 

exec 6>&1 #Make file descriptor 6 point to standard output.

 

exec > $LOGFILE # Make the standard output point to $LOGFILE, this command is default to exec 1> $LOGFILE

 

#Output any things, for example, echo "hello", the output goes $LOGFILE

 

exec 1>&6 6>&-  # Recover the standard output and close the file descriptor 6

 

 

/dev and /proc

The /dev directory contains entries for the physical devices that may or may not be present in the hardware.

 

The /proc directory is actually a pseudo-filesystem. The files in /proc mirror currently running system and
kernel processes and contain information and statistics about them. It is a snapshot of the OS.

 

Think of /dev/null as a black hole. It is essentially the equivalent of a write-only file. Everything written to it disappears. Attempts to read or output from it result in nothing. All the same,/dev/null can be quite useful from both the command line and in scripts.

 

Like /dev/null, /dev/zero is a pseudo-device file, but it actually produces a stream of nulls(binary zeros, not the ASCII kind). Output written to /dev/zero disappears, and it is fairly difficult to actually read the nulls emitted there, though it can be done with od or a hex editor. The chief use of /dev/zero is creating an initialized dummy file of predetermined length intended as a temporary swap file.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值