1,571 reputation
416
bio website Idonthaveany
location Rainbow, ME
age 37
visits member for 1 year, 10 months
seen yesterday

Way up high...


Sep
30
awarded  Explainer
Sep
21
awarded  Custodian
Aug
13
awarded  Good Answer
Jul
24
awarded  bash
Jun
23
awarded  Enlightened
Jun
23
awarded  Nice Answer
May
1
awarded  Nice Answer
Apr
29
comment Need a shell script to find the latest file from a directory and move it to another on a weekly basis
Don't parse the output of ls
Apr
29
comment Need a shell script to find the latest file from a directory and move it to another on a weekly basis
Don't parse the output of ls
Apr
29
comment Need a shell script to find the latest file from a directory and move it to another on a weekly basis
Don't parse the output of ls.
Apr
27
comment Finding and deleting all files that begin with . within a directory
That's why I specified (though parenthesized) trying :D. You'll get some junk on stderr though. Also, why not, simply rm /home/terdon/foobar/.[^.]*? (oh, you will argue that this might potentially exceed the max number of arguments).
Apr
27
comment Finding and deleting all files that begin with . within a directory
Don't you mean find /path/to/start/dir/ -maxdepth 1 -name ".*" -type f -exec rm {} + instead? with -maxdepth 0 you won't find anything...
Apr
27
comment Finding and deleting all files that begin with . within a directory
You're also (trying) to delete folders that start with a ., whereas the OP mentions files. (Oh, then you will argue that everything is a file in Unix...).
Apr
26
comment How to make a shell script pipe aware
I said you'll have a hard time parsing the input because echo shell\ script dns and echo shell script dns have the same output. Good luck.
Apr
26
comment How to make a shell script pipe aware
Now if your question is about How to read from stdin, then you must have a look at the builtin read. You'll have a hard time parsing the input, though. Good luck. Then you're on your own to do the logic to deal with the input from stdin and arguments. Good luck again. At some point, if you have specific questions, feel free to come back and ask these specific questions! :).
Apr
26
comment How to make a shell script pipe aware
No, you're wrong. That's not how these tools work. Sorry, I don't have enough room in this margin to explain to you why, but believe me, that's not how they work. Actually I do have enough room to show you that you're wrong. Take the case of sed. Compare sed 's/a/b/' with echo 's/a/b/' | sed. What happens? it's not the same thing, right?
Apr
26
comment How to make a shell script pipe aware
@choroba you're right, it's still in google's cache :).
Apr
26
comment How to make a shell script pipe aware
Last comment: whats shell\ script dns is actually shorter and easier to parse than echo shell\ script dns | whats. So why would you read stdin anyways?
Apr
26
comment How to make a shell script pipe aware
And how would you handle echo shell\ script dns | whats some\ other\ stuff foo?
Apr
24
comment How do you cd into the first available folder without typing out the name?
cd */ might do the trick