Skip to content

Instantly share code, notes, and snippets.

@timf
Created February 2, 2013 03:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timf/4696052 to your computer and use it in GitHub Desktop.
Save timf/4696052 to your computer and use it in GitHub Desktop.
Pipe or redirect-output from a sh for loop
(~)$ for x in `seq 5`; do echo $x; done | xargs ls
ls: 1: No such file or directory
ls: 2: No such file or directory
ls: 3: No such file or directory
ls: 4: No such file or directory
ls: 5: No such file or directory
(~)$ for x in `seq 5`; do echo $x; done > tmpfile
(~)$ cat tmpfile
1
2
3
4
5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment