Fighting UUOC
with
I found that while loops are converted to
Syntax error!
Why syntax error? It would perfectly make sense.
Further, read the article how-would-you-like-your-loops-served-today
Then I tested with the best shell ever, zsh.
It works!
while is not an external command, it's a shell builtin. The same rules don't always apply. That you can redirect into them at all is a huge blessing and feature rather unique to Bourne-based shells.
I wrote by accident:
cd .
and even hit ENTER.
Then I realized this is probably the most useless command that you can imagine. Yes, perhaps it could assert that there is still a working filesystem, but I am not sure about it.
What do you think?
Can you think of any more useless commands? :) (6 Replies)
cat ~/text.xt | while read line
do
echo ${line} | perl -pe 's/(\d+)/localtime($1)/e'
done
how can i efficiently re-code the above?
also, no matter how i run this, i'm not getting the current/correct date. the contents of the "text.xt" looks like this:
SERVICES... (2 Replies)
Hello,
So I sorted my file as I was supposed to:
sort -n -r -k 2 -k 1 file1 | uniq > file2
and when I wrote
> cat file2
in the command line, I got what I was expecting, but in the script itself
...
sort -n -r -k 2 -k 1 averages | uniq > temp
cat file2
It wrote a whole... (21 Replies)
Hi, I came across with this line "set -x" in the beginning of a script, but i can't find one logic reason for this... should be something else after, i think.... anyone can help?
tanx (2 Replies)