Skip to main content
Post Closed as "Duplicate" by muru bash
edited body; edited title
Source Link
ilkkachu
  • 148.1k
  • 16
  • 268
  • 441

How to Pipe Outputpipe output of a Commandcommand to another Commandcommand (Whichwhich does Notnot take a Filefile as Inputinput?)

What I want

Simplified command: echo "helloworld" | echo $1

  • I know, this would be possible with cat, but what if a command like echo does not take a file as input?

My actual command: ls -li init.vim | cut -d " " -f 1 | find / -inum $1

  • I know it does not work with $1 like that, this is only an example and $1 is only a placeholder.

Command Substitutionsubstitution: find / -inum $(ls -li init.vim | cut -d " " -f 1)

  • This works fine, but I don't want it with command substitution.

Questions

  1. Does this work without any workarounds or command substitution?
  2. If it does not, what are the best ways to do this?


Thank you for your help :)

How to Pipe Output of a Command to another Command (Which does Not take a File as Input?)

What I want

Simplified command: echo "helloworld" | echo $1

  • I know, this would be possible with cat, but what if a command like echo does not take a file as input?

My actual command: ls -li init.vim | cut -d " " -f 1 | find / -inum $1

  • I know it does not work with $1 like that, this is only an example and $1 is only a placeholder.

Command Substitution: find / -inum $(ls -li init.vim | cut -d " " -f 1)

  • This works fine, but I don't want it with command substitution.

Questions

  1. Does this work without any workarounds or command substitution?
  2. If it does not, what are the best ways to do this?


Thank you for your help :)

How to pipe output of a command to another command (which does not take a file as input?)

What I want

Simplified command: echo "helloworld" | echo $1

  • I know, this would be possible with cat, but what if a command like echo does not take a file as input?

My actual command: ls -li init.vim | cut -d " " -f 1 | find / -inum $1

  • I know it does not work with $1 like that, this is only an example and $1 is only a placeholder.

Command substitution: find / -inum $(ls -li init.vim | cut -d " " -f 1)

  • This works fine, but I don't want it with command substitution.

Questions

  1. Does this work without any workarounds or command substitution?
  2. If it does not, what are the best ways to do this?


Thank you for your help :)

Source Link
Bog
  • 1.2k
  • 1
  • 7
  • 27

How to Pipe Output of a Command to another Command (Which does Not take a File as Input?)

What I want

Simplified command: echo "helloworld" | echo $1

  • I know, this would be possible with cat, but what if a command like echo does not take a file as input?

My actual command: ls -li init.vim | cut -d " " -f 1 | find / -inum $1

  • I know it does not work with $1 like that, this is only an example and $1 is only a placeholder.

Command Substitution: find / -inum $(ls -li init.vim | cut -d " " -f 1)

  • This works fine, but I don't want it with command substitution.

Questions

  1. Does this work without any workarounds or command substitution?
  2. If it does not, what are the best ways to do this?


Thank you for your help :)