Find the answer to your Linux question:
Results 1 to 7 of 7

Thread: use output

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    use output


    Hi,

    how can I use the output of "locate php.ini" as the argument of vi ?

  2. #2
    Linux Engineer
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    765
    Code:
    vi $(locate php.ini)

  3. #3
    Why this doesn't work ?

    Code:
    locate php.ini | vi

  4. $spacer_open
    $spacer_close
  5. #4
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,643
    Because vi expects a parameter and you instead pipe the path(s)+filename(s) to stdin
    You must always face the curtain with a bow.

  6. #5
    Quote Originally Posted by Irithori View Post
    Because vi expects a parameter and you instead pipe the path(s)+filename(s) to stdin
    Isn't path+filename the parameter that vi expects ?

  7. #6
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,892
    Quote Originally Posted by umbloaded View Post
    Isn't path+filename the parameter that vi expects ?
    Yes, but it expects them as command line parameters not as input from stdin
    Should you be sitting wondering,
    Which Batman is the best,
    There's only one true answer my friend,
    It's Adam Bloody West!


    The Fifth Continent

  8. #7
    Linux Engineer
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    765
    This is supplying the location information on stdin and vi is expecting editing commands on standard input (stdin) and the file(s) to edit as arguments. The "$( command )" placed the standard output (stdout) of the command in place of the "$(command)" before bash starts the command.'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •