V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
soonlai
V2EX  ›  Linux

bash 函数调用求解

  •  
  •   soonlai · Apr 23, 2013 · 4206 views
    This topic created in 4760 days ago, the information mentioned may be changed or developed.
    function fcontent() {

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

    } #查找所有文件内容

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

    #!/bin/bash
    function fcontent() {
    grep -nHR --color=auto "$@" .
    }
    soonlai
        2
    soonlai  
    OP
       Apr 23, 2013
    不错,谢谢!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   757 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 20:36 · PVG 04:36 · LAX 13:36 · JFK 16:36
    ♥ Do have faith in what you're doing.