Distributions
› Ubuntu
› Fedora
› CentOS
中文资源站
› 网易开源镜像站
soonlai
V2EX  ›  Linux

bash 函数调用求解

  •  
  •   soonlai · Apr 23, 2013 · 4562 views
    This topic created in 4914 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   ·   Privacy   ·   Solana   ·   2601 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 05:10 · PVG 13:10 · LAX 22:10 · JFK 01:10
    ♥ Do have faith in what you're doing.