Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Command line -- while
Name: surfistadesampa Date: November 18, 2004 at 05:49:08 Pacific OS: Linux CPU/Ram: Pentium III
Comment:
Hii people uhhuhuhu
i need use the while command in a command line in a c shell and bash
exemple
ssh 172.30.30.30 -l user set a=1; while ( $a <= 10 ); echo $a. set a=`expr #a + 1`; end
Name: Don Arnett Date: November 18, 2004 at 07:35:29 Pacific
Reply:
I don't have access to a bash shell at the moment, but was able to get the below to work (without the ssh). You may not need the " either, but I like to use them around the command.
ssh 172.30.30.30 -l user "a=1; while [ $a -le 10 ]; do echo $a; a=`expr $a + 1`; done"
Be sure to come back and let us know if our suggestions helped!
0
Response Number 2
Name: surfistadesampa Date: November 18, 2004 at 08:44:39 Pacific
Reply:
nothing happended... this string a=1; while [ $a -le 10 ]; do echo $a; a=`expr $a + 1`; done
its ok,,, but the problem is i do it in another computer with csh ,, i try many possibilities,,, but its almost impossible...
0
Response Number 3
Name: Wolfbone Date: November 18, 2004 at 08:46:19 Pacific
Reply:
It's a lot easier if you use the arithmetic expressions and evaluation native to bash:
for ((a=1;a<=10;a++));do echo $a; done
0
Response Number 4
Name: Wolfbone Date: November 18, 2004 at 09:57:00 Pacific
Reply:
Wait a minute! - you're running in a csh environment on the remote machine?
In the csh manual it says you have to have the 'while' and 'end' statements on a line on their own:
ssh 172.30.30.30 -l user 'set a=1 while ( $a <= 10 ) ... end'
0
Response Number 5
Name: surfistadesampa Date: November 19, 2004 at 06:38:40 Pacific
Reply:
i have been tried it too,,, but the command "while" execute only 1 time the loop, and it have to be execute 10 times...
yeah,,, i am running csh in a remote machine
huhuhuhuhu it is almost impossible....
0
Response Number 6
Name: Wolfbone Date: November 19, 2004 at 21:44:33 Pacific
Reply:
Yes - I tried this myself and everything works fine with bash but it does not work with csh. Not much does. ;-)
0
Response Number 7
Name: surfistadesampa Date: November 23, 2004 at 05:40:36 Pacific
Summary: Hi , I am just looking for feedback on my open source project.So here it is. Its at http://wsdlpull.sf.net Its a WSDL library which has an API and a command line tool to do dynamic web service invocat...
Summary: Hie all, I'm trying to configure a diskless cluster network where all clients in the network will have to boot through the network from a specific server which provides the kernel to the diskless clie...
Summary: Hi, i have a script submit using GET. Of couse I am type the following URL on the borswer: http://mydomain.com/myscript.pl?fname=abc&lastname=eee but how do i run it on the command line? i tried: ./my...