V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
soonlai
V2EX  ›  Linux

bash 函数调用求解

  •  
  •   soonlai · 2013-04-23 15:29:52 +08:00 · 3300 次点击
    这是一个创建于 4010 天前的主题,其中的信息可能已经有所发展或是发生改变。
    function fcontent() {

    grep -nHR --color=auto '$@' .

    } #查找所有文件内容

    这是我的函数,当我像这样调用 fcontent explain ,$@ 没有替换。
    2 条回复    1970-01-01 08:00:00 +08:00
    arbeitandy
        1
    arbeitandy  
       2013-04-23 16:28:44 +08:00
    用雙引號

    #!/bin/bash
    function fcontent() {
    grep -nHR --color=auto "$@" .
    }
    soonlai
        2
    soonlai  
    OP
       2013-04-23 17:11:14 +08:00
    不错,谢谢!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5413 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 07:14 · PVG 15:14 · LAX 00:14 · JFK 03:14
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.