当前位置: 技术问答>linux和unix
shell变量在函数间修改问题
来源: 互联网 发布时间:2016-12-27
本文导语: #!/bin/bash RootPath=. function aaa () { a=123 b=456 echo In aaa a:$a b:$b } function bbb () { int=1 find $RootPath | sed '/svn/d' > file cat file | while [ $int -gt...
#!/bin/bash
RootPath=.
function aaa () {
a=123
b=456
echo In aaa a:$a b:$b
}
function bbb () {
int=1
find $RootPath | sed '/svn/d' > file
cat file | while [ $int -gt 0 ]
do
echo $line | grep ".cpp$"
(( a=$a+123 ))
(( b=$b+456 ))
(( int=$int-1 ))
echo In bbb a:$a b:$b
done
RootPath=.
function aaa () {
a=123
b=456
echo In aaa a:$a b:$b
}
function bbb () {
int=1
find $RootPath | sed '/svn/d' > file
cat file | while [ $int -gt 0 ]
do
echo $line | grep ".cpp$"
(( a=$a+123 ))
(( b=$b+456 ))
(( int=$int-1 ))
echo In bbb a:$a b:$b
done