I want to assign the result of an expression to (i.e., the output from a command) to a variable and concatenatethen manipulate it – for example, concatenate it with a string, then echo it. Here's Here's what I've got:
#!/bin/bash
cd ~/Desktop;
thefile= ls -t -U | grep -m 1 "Screen Shot";
echo "Most recent screenshot is: "$thefile;
But that outputs:
Screen Shot 2011-07-03 at 1.55.43 PM.png
Most recent screenshot is:
So, it looks like that isn't getting assigned to $thefile, and is being printed as it's executed.
What am I missing?