4
votes
4answers
355 views

ls command operating differently depending on recipient

How does commands like ls know what its stdout is? It seems ls is operating different depending on what the target stdout is. For example if I do: ls /home/matt/tmp the result is: a.txt b.txt ...
6
votes
1answer
6k views

Bash: assign ls | grep to a variable and echo it with a string

I want to assign the result of an expression to a variable and concatenate it with a string, then echo it. Here's what I've got: #!/bin/bash cd ~/Desktop; thefile= ls -t -U | grep -m 1 "Screen Shot"; ...
6
votes
3answers
1k views

How do i open all files that are the result of a ls command?

I'd like to open all text files that are the result of a ls command using a text editor. How do i do this?