0

I use bash 4.4.

How do I print the a file to command line.

For example,

$ printf "HELLO" > file
$ my-command file
$ HELLO

where the HELLO in the last line shows after the second command is run.

A similar method is

$ history
1 ls
2 cd ~
$ !2:p
$ cd ~

which will show the historical command in the next command line without executing it.

Vito Chou
  • 281
  • 2
  • 4
  • What do you mean exactly? `cat FILE` to print the content of a file to command line? Is that what you meant? or might be a good idea to clarify the title and elaborate the question a little bit. – Rakib Fiha Feb 11 '20 at 06:51
  • 2
    Possible duplicate of [Can bash write to its own input stream?](//unix.stackexchange.com/q/213799) – Stéphane Chazelas Feb 11 '20 at 06:57
  • @StéphaneChazelas Yeah, I cannot find a proper keyword for this kind of question. Thank you. – Vito Chou Feb 11 '20 at 06:59

0 Answers0