- 論壇徽章:
- 0
|
在一篇帖子里看到
trap 'command' EXIT 或 trap 'command' 0
但是自己照著寫的shell 腳本報(bào)錯(cuò)。。。
不知道&apos有什么作用,為什么我的腳本會(huì)報(bào)錯(cuò)。
謝謝
$ cat –n exp2.sh
1 #!/bin/bash
2 trap 'echo “before execute line LINENO, a=$a,b=$b,c=$c”' DEBUG
3 a=1
4 if [ "$a" -eq 1 ]
5 then
6 b=2
7 else
8 b=1
9 fi
10 c=3
11 echo "end"
./exp2.sh: line 3: apos: command not found
before execute line:3, a=, b=, c=
./exp2.sh: line 3: apos: command not found
./exp2.sh: line 3: DEBUG: command not found
end
|
|