|
藍森林 http://www.lslnet.com 2006年6月26日 11:18
請教我這樣的shell為什麼不能執行?謝謝
-------startlistA.sh
#!/bin/sh
filename=${0%.*}
name=$ basename $filename
newvar=`basename $filename|cut -c6-`
sys=/home/lhj/webapp/src/sysmanage.properties
option=`grep option_$newvar $sys |awk -F='{print $2}'`
echo $option
echo "$option /home/lhj/dealcap/shelltest/$newvar.sh" >>/home/lhj/dealcap/shelltest/temp.sh
執行結果為:
[root@zjhc411 shelltest]# ./startlistA.sh
startlistA
Usage: awk [POSIX or GNU style options] -f progfile [--] file ...
Usage: awk [POSIX or GNU style options] [--] 'program' file ...
POSIX options: GNU long options:
-f progfile --file=progfile
-F fs --field-separator=fs
-v var=val --assign=var=val
-m[fr] val
-W compat --compat
-W copyleft --copyleft
-W copyright --copyright
-W dump-variables[=file] --dump-variables[=file]
-W gen-po --gen-po
-W help --help
-W lint[=fatal] --lint[=fatal]
-W lint-old --lint-old
-W non-decimal-data --non-decimal-data
-W profile[=file] --profile[=file]
-W posix --posix
-W re-interval --re-interval
-W source=program-text --source=program-text
-W traditional --traditional
-W usage --usage
-W re-interval --re-interval
-W source=program-text --source=program-text
-W traditional --traditional
-W usage --usage
-W version --version
To report bugs, see node `Bugs' in `gawk.info', which is
section `Reporting Problems and Bugs' in the printed version.
gawk is a pattern scanning and processing language.
By default it reads standard input and writes standard output.
Examples:
gawk '{ sum += $1 }; END { print sum }' file
gawk -F: '{ print $1 }' /etc/passwd |
請教我這樣的shell為什麼不能執行?謝謝
-->
[url=http://blog.www.lslnet.com/linux/index.php?op=ViewArticle&articleId=571&blogId=126][u]shell入門[/u] |
請教我這樣的shell為什麼不能執行?謝謝
知道了,原來少了空格。謝謝
option=`grep option_$newvar $sys |awk -F= '{ print $2 }'` |
| |