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

bash 函数调用求解

  •  
  •   soonlai · Apr 23, 2013 · 4651 views
    This topic created in 4948 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
    arbeitandy
    Apr 23, 2013
    1
    用雙引號

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