Patryk Krzyzanski
Patryk Krzyzanski

Reputation: 57

Pipe output of command in Shell, how to redirect without save it between in an file?

do someone know how to make this in one line of code. I mean by that without save the output of the ls in temp.txt between

ls | cat $x > temp.txt
while read line; do echo foo/$line; done < temp.txt

Upvotes: 0

Views: 43

Answers (1)

oguz ismail
oguz ismail

Reputation: 50750

Use printf with a glob.

printf 'foo/%s\n' *

Upvotes: 1

Related Questions