Wednesday, August 31, 2005

Why I love Linux

It's been a month since I am here and for a month I have been working on Win2K at my office. Haven't seen Linux in loooong time. Missing it, especially today.

Today I needed to do some scripting in Windows, for some personal work. Due to inefficiency in finding some advanced features for wget and in the presence any good download manager, I needed to shift towards this scripting. Oh God, What an unfortunate soul. Need to work in windows and that too with scripting. After coming to real world (read industry) I started loving linux more, you know why? because here you can't use pirated softwares any more and this is not IITK, where you just switch on your DC++ and download any bloody software within seconds. Thought, Let's take a dive and at unfortunate moment started scripting.

Now, I needed to make a FOR loop. After trying out different keywords found out following command

FOR %%e IN (1 2 3 4 5 6) DO ...

Now why would you need to type two '%' to mark a variable?? Anyways, this command will run for six time take value from 1 to 6. Now what would you do if you need to run loop for say 100 times are you going to write (1 2 3 ... 100). Well, you have to, I couldn't find any other technique. So thought let's try some another technique, something similar to while loop, implement using notorious GOTO. Now the question was how to set a variable and use it. tried out various combination

i=100
%i=100
%%i=100
...

Neither worked and suddenly remembered good old days where somehow I studied AUTOEXEC.BAT and they used something like SET for setting a variable. %$@@#$%%@$#. What the hell? why to type something extra as SET, I bet even Bill Gates won't be able to tell you that. Don't lose the spirit, go ahead. I thought. Now, came the next ultimate question, how to increment a variable? again combinations...

i=%i+1
i=%%i+1
%%i=%i%+1
...

Again, no luck. There exists something like INCR in dos, but for some reason that won't work in Win2K, so here is where I am stuck up. No clue to get out of this. Don't think I didn't Google for any of this stuff. After hard work on Google, I am pouring out my frustration here. Should get back to search now I guess. God bless me!!

Recent breakthrough : Finally managed to find out the way to increment a variable. it goes

SET /A i += 1

Now don't ask me why to put extra /A for doing so, in one other achievement, I found out that IF syntax would be like

IF NOT "i"="100"

but I am still unaware about use of < or > in IF, because if I use those, it says unexpected end of statement or something like that. Let it be whatsoever it is, I am done with my job. After I was done with my download thing, I am enjoying the geeky strips I downloaded and sharing one which is very pertinent with this one.

8 comments:

Enjoy Life!! said...

Cool strip :d

I think u suffer from lack of a good free download manager. Check out these "free" download managers for windows:
http://sourceforge.net/projects/downloadplus
http://sourceforge.net/projects/gdownloader
http://sourceforge.net/projects/sharpdownload
http://sourceforge.net/projects/jdownload

Bhumi said...

the strip was GOOD!! :) though m not a CS person can feel your frust here..

Kuldip Patel said...

In my case its diffrent....

After working in Linux for a long time I feel the following...


In these darkened rooms, where I spend
oppresive days, I pace to and fro
to find the windows. -- When a window
opens, it will be a consolation. --
But the windows cannot be found, or I cannot
find them. And maybe it is best that I do not find them.
Maybe the light will be a new tyranny.
Who knows what new things it will reveal.

Constantine P. Cavafy (1903)

Hemal Modi said...

Note that the '%' prompt indicates that the command should be issued from the C shell, and the '$' prompt indicates the Bourne shell. It's actually amazing how clever Unix is ;)


% ls God
God not found

% ar m God
ar: God does not exist

% rm God
rm: God nonexistent

% ar t God
ar: God does not exist

% ar r God
ar: creating God


% set i="Democratic_Platform";mkdir $i;chmod 000 $i;ls $i
Democratic_Platform unreadable

% "How would you rate The President's incompetence in Katrina Disaster?
Unmatched ".

% %Vice-President
%Vice-President: No such job.

% scan for <<"Arnold Schwarzenegger"^J^D
Arnold Schwarzenegger: << terminator not found



% ^How did the sex change^ operation go?
Modifier failed.

% ^How did the sex change operation go?^
Bad substitute.


% ^What is saccharine? [or % !:say, what is saccharine?]
Bad substitute.

% If I had a ( for every time Windows crashed, what would I have?
Too many ('s.

% got a light?
No match.

% man: why did you get a divorce?
man:: Too many arguments.

% look in cupboard
can't open cupboard.

% 'thou shalt not commit adultery'
thou shalt not commit adultery: Command not found.

% date me
You are not superuser: date not set
Thu Sep 8 15:52:30 PDT 2005

% %blow
%blow: No such job.

% sleep with me
bad character

% nice man woman
No manual entry for woman.

% man rear
No manual entry for rear.

$ man -kisses dog
dog: nothing appropriate

% man ' automatic insertion'
No manual entry for automatic insertion.

% make love
Make: Don't know how to make love. Stop.

% make sense
Make: Don't know how to make sense. Stop.

% make bottle.open
Make: Don't know how to make bottle.open. Stop.

% make believe
make: don't know how to make believe. Stop

% make 'heads or tails of all this'
Make: Don't know how to make heads or tails of all this. Stop.



% [Where is Hemal Modi?
Missing ].

$ "Hemal Modi"
Hemal Modi: not found

$ echo MC Hammer > this
$ chown mchammer this $ touch this
Can't touch this: permission denied.



% \(-
(-: Command not found.



% cp /dev/null sex;chmod 000 sex;more sex
sex: Permission denied
% mv sex show
% strip show
strip: show: Permission denied

% who is my match?
No match.

% awk "Nishit Desai, the ship is sinking"
awk: syntax error near line 1
awk: bailing out near line


$ PATH=pretending! /usr/ucb/which sense
no sense in pretending!

% mkdir "The phone book"
% more "The phone book"
The phone book is a directory


% cat "door:paws too slippery"
cat: cannot open door:paws too slippery

% cat 'the can of tuna'
cat: cannot open the can of tuna

% cat "food in cans"
cat: Cannot open food in cans: No such file or directory

$ mkdir matter; cat>matter
matter: cannot create


$ drink < bottle; opener
bottle: cannot open
opener: not found

Now why in the world would anyone NOT want to use UNIX ?!!

Sujoo said...

The comic strip was good !! :D:D

Anonymous said...

Not that they make it easy to discover, but....

for /L %x in (1,1,100) do echo %x

the format of the parens is (start,step,end) ... "for" can do almost anything, check out "for /?"

---S

Nishit said...

thanks anon, but it would be nice if you'd written your name instead of 'S'.

Anonymous said...

Cool blog, i just randomly surfed in, but it sure was worth my time, will be back! May be www.juggad.com would be a better title for your blog... The domain has also been put up for sale recently! Cheers :)