---
title: "Shell 编程2(Beginning Linux Programming 笔记3)"
author: "hickwu"
date: "2008-12-08T05:32:22Z"
tags: []
slug: "shell-2-beginning-linux-programming-3"
draft: false
lastmod: "2008-12-08T05:32:22Z"
id: 290365
url: "https://hickwu.iteye.com/blog/290365"
---

p76 列表(list) AND 列表和 OR 列表跟 C 语言里的逻辑运算类似。AND 列表类似 “statement1 && statement2 && statement3″, OR 列表形式 “statement1 || statement2 || statement3″ 。为了实现更复杂的语句列表，有时候可以使用 {} 包含的语句块(还没有实践)： get\_confirm && {  grep -v “$cdcatnum” $tracks\_file &gt; $temp\_file  cat $temp\_file &gt; $tracks\_file  echo  add\_record\_tracks} p79 bash 函数同样需要先定义后使用，但是调用方式跟 C 里稍有不同。 foo() {  echo “Function foo is executing”}echo "script starting"fooecho "script ended" p80 前面介绍的脚本参数变量： “$\*, $@, \[...]