开发者

How can i delete double quote in bash file.(Linux)

for i in $(some function); do somefunction2 $i; done

-su: 0 5 : syntax error in expression (error token is "5 ")

My problem is some function return "0 9" I can't use this:

for i in "0 5"; do somefunction2 $i; done

Results are the same

-su: 0 5 : syntax error in expression (error token is "5 ")

but if use this:

for i in 0 5; do somefunction2 $i; done

It works. Some开发者_Python百科 function for loop and echo this

echo -n "$i "

I want return 0 5 not "0 5" How can I do?


This should solve your problem:

eval for i in $(some function); do somefunction2 \$i; done

However, it's not clear from your question where does the su come from ?


You don't need to delete anything:

   function five {
   echo 0;
   echo 5;
   }

   function fiveString {
   echo "0 5";
   }

   for i in `five`;do
   echo process $i;
   done

   for i in $(echo $(fiveString));do
   echo process $i;
   done
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜