How do I redirect output of command into ls? [duplicate]
This question already has an answer here:
How to pass the output of one command as the command-line argument to another?
5 answers
Redirecting the content of a file to the command “echo”
5 answers
Pass the output of previous command to next as an argument
6 answers
I have a problem with redirections :
$ which python3
gives me
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
and
$ ls -l /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
gives me
lrwxr-xr-x 1 root admin 9 5 fév 18:30 /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -> python3.7
but
which python3 | ls -l
don't gives me the same result.
Do you know why ? And what is the right command for redirection ?
I'm using OSX.
I have to say that the following question pass the output of previous command to next as an argument may be the same as this one, but if I look the answers that were given, there I'm lost. To be useful, they require more advanced knowledge or study than those given here.
shell osx
marked as duplicate by Michael Homer, Kevin, l0b0, Jeff Schaller, Sparhawk Feb 15 at 4:00
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
How to pass the output of one command as the command-line argument to another?
5 answers
Redirecting the content of a file to the command “echo”
5 answers
Pass the output of previous command to next as an argument
6 answers
I have a problem with redirections :
$ which python3
gives me
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
and
$ ls -l /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
gives me
lrwxr-xr-x 1 root admin 9 5 fév 18:30 /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -> python3.7
but
which python3 | ls -l
don't gives me the same result.
Do you know why ? And what is the right command for redirection ?
I'm using OSX.
I have to say that the following question pass the output of previous command to next as an argument may be the same as this one, but if I look the answers that were given, there I'm lost. To be useful, they require more advanced knowledge or study than those given here.
shell osx
marked as duplicate by Michael Homer, Kevin, l0b0, Jeff Schaller, Sparhawk Feb 15 at 4:00
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
I've updated the list of duplicates to some other better (IMHO) questions on the same topic. Especially Redirecting the content of a file to the command "echo" mirrors your question quite well asecho
behaves likels
with regards to (not) reading its standard input.
– Kusalananda
Feb 16 at 10:33
add a comment |
This question already has an answer here:
How to pass the output of one command as the command-line argument to another?
5 answers
Redirecting the content of a file to the command “echo”
5 answers
Pass the output of previous command to next as an argument
6 answers
I have a problem with redirections :
$ which python3
gives me
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
and
$ ls -l /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
gives me
lrwxr-xr-x 1 root admin 9 5 fév 18:30 /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -> python3.7
but
which python3 | ls -l
don't gives me the same result.
Do you know why ? And what is the right command for redirection ?
I'm using OSX.
I have to say that the following question pass the output of previous command to next as an argument may be the same as this one, but if I look the answers that were given, there I'm lost. To be useful, they require more advanced knowledge or study than those given here.
shell osx
This question already has an answer here:
How to pass the output of one command as the command-line argument to another?
5 answers
Redirecting the content of a file to the command “echo”
5 answers
Pass the output of previous command to next as an argument
6 answers
I have a problem with redirections :
$ which python3
gives me
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
and
$ ls -l /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
gives me
lrwxr-xr-x 1 root admin 9 5 fév 18:30 /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -> python3.7
but
which python3 | ls -l
don't gives me the same result.
Do you know why ? And what is the right command for redirection ?
I'm using OSX.
I have to say that the following question pass the output of previous command to next as an argument may be the same as this one, but if I look the answers that were given, there I'm lost. To be useful, they require more advanced knowledge or study than those given here.
This question already has an answer here:
How to pass the output of one command as the command-line argument to another?
5 answers
Redirecting the content of a file to the command “echo”
5 answers
Pass the output of previous command to next as an argument
6 answers
shell osx
shell osx
edited Feb 16 at 10:29
Raoul HATTERER
asked Feb 14 at 16:34
Raoul HATTERERRaoul HATTERER
184
184
marked as duplicate by Michael Homer, Kevin, l0b0, Jeff Schaller, Sparhawk Feb 15 at 4:00
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Michael Homer, Kevin, l0b0, Jeff Schaller, Sparhawk Feb 15 at 4:00
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
I've updated the list of duplicates to some other better (IMHO) questions on the same topic. Especially Redirecting the content of a file to the command "echo" mirrors your question quite well asecho
behaves likels
with regards to (not) reading its standard input.
– Kusalananda
Feb 16 at 10:33
add a comment |
I've updated the list of duplicates to some other better (IMHO) questions on the same topic. Especially Redirecting the content of a file to the command "echo" mirrors your question quite well asecho
behaves likels
with regards to (not) reading its standard input.
– Kusalananda
Feb 16 at 10:33
I've updated the list of duplicates to some other better (IMHO) questions on the same topic. Especially Redirecting the content of a file to the command "echo" mirrors your question quite well as
echo
behaves like ls
with regards to (not) reading its standard input.– Kusalananda
Feb 16 at 10:33
I've updated the list of duplicates to some other better (IMHO) questions on the same topic. Especially Redirecting the content of a file to the command "echo" mirrors your question quite well as
echo
behaves like ls
with regards to (not) reading its standard input.– Kusalananda
Feb 16 at 10:33
add a comment |
3 Answers
3
active
oldest
votes
ls
does not take input from standard in, but only from arguments:
Try ls -l "$(which python3)"
add a comment |
ls
does not read from the pipe. In fact, ls
does not use its standard input at all.
Instead, you have to pass the thing you'd like to run ls -l
on via the command line of ls
:
ls -l "$( which python3 )"
This uses a command substitution on the command line of ls -l
which will expand to the output of the which
command. This will then be used as a command line argument for ls
.
Alternatively:
ls -l "$( command -v python3 )"
Related:
- Why not use "which"? What to use then?
add a comment |
Other answers are good, but this is also handy:
which python3 | xargs ls -l
xargs
gets values from stdin
and appends them as command-line argument to the specified program.
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
ls
does not take input from standard in, but only from arguments:
Try ls -l "$(which python3)"
add a comment |
ls
does not take input from standard in, but only from arguments:
Try ls -l "$(which python3)"
add a comment |
ls
does not take input from standard in, but only from arguments:
Try ls -l "$(which python3)"
ls
does not take input from standard in, but only from arguments:
Try ls -l "$(which python3)"
edited Feb 14 at 19:35
Jeff Schaller
43.4k1160140
43.4k1160140
answered Feb 14 at 16:37
ctrl-alt-delorctrl-alt-delor
12k42360
12k42360
add a comment |
add a comment |
ls
does not read from the pipe. In fact, ls
does not use its standard input at all.
Instead, you have to pass the thing you'd like to run ls -l
on via the command line of ls
:
ls -l "$( which python3 )"
This uses a command substitution on the command line of ls -l
which will expand to the output of the which
command. This will then be used as a command line argument for ls
.
Alternatively:
ls -l "$( command -v python3 )"
Related:
- Why not use "which"? What to use then?
add a comment |
ls
does not read from the pipe. In fact, ls
does not use its standard input at all.
Instead, you have to pass the thing you'd like to run ls -l
on via the command line of ls
:
ls -l "$( which python3 )"
This uses a command substitution on the command line of ls -l
which will expand to the output of the which
command. This will then be used as a command line argument for ls
.
Alternatively:
ls -l "$( command -v python3 )"
Related:
- Why not use "which"? What to use then?
add a comment |
ls
does not read from the pipe. In fact, ls
does not use its standard input at all.
Instead, you have to pass the thing you'd like to run ls -l
on via the command line of ls
:
ls -l "$( which python3 )"
This uses a command substitution on the command line of ls -l
which will expand to the output of the which
command. This will then be used as a command line argument for ls
.
Alternatively:
ls -l "$( command -v python3 )"
Related:
- Why not use "which"? What to use then?
ls
does not read from the pipe. In fact, ls
does not use its standard input at all.
Instead, you have to pass the thing you'd like to run ls -l
on via the command line of ls
:
ls -l "$( which python3 )"
This uses a command substitution on the command line of ls -l
which will expand to the output of the which
command. This will then be used as a command line argument for ls
.
Alternatively:
ls -l "$( command -v python3 )"
Related:
- Why not use "which"? What to use then?
edited Feb 14 at 16:56
answered Feb 14 at 16:37
KusalanandaKusalananda
135k17256424
135k17256424
add a comment |
add a comment |
Other answers are good, but this is also handy:
which python3 | xargs ls -l
xargs
gets values from stdin
and appends them as command-line argument to the specified program.
add a comment |
Other answers are good, but this is also handy:
which python3 | xargs ls -l
xargs
gets values from stdin
and appends them as command-line argument to the specified program.
add a comment |
Other answers are good, but this is also handy:
which python3 | xargs ls -l
xargs
gets values from stdin
and appends them as command-line argument to the specified program.
Other answers are good, but this is also handy:
which python3 | xargs ls -l
xargs
gets values from stdin
and appends them as command-line argument to the specified program.
answered Feb 14 at 23:17
jickjick
1392
1392
add a comment |
add a comment |
I've updated the list of duplicates to some other better (IMHO) questions on the same topic. Especially Redirecting the content of a file to the command "echo" mirrors your question quite well as
echo
behaves likels
with regards to (not) reading its standard input.– Kusalananda
Feb 16 at 10:33