0

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
2
  • What is $x there? Commented Mar 21, 2020 at 11:40
  • the piped output of ls Commented Mar 21, 2020 at 18:13

1 Answer 1

1

Use printf with a glob.

printf 'foo/%s\n' *
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.