unix example issues

hi,

I am trying unix .sh scripts on my windows laptop
https://www.tutorialspoint.com/unix/unix-loop-control.htm
#!/bin/sh

a=0

while [ $a -lt 10 ]
do
   echo $a
   if [ $a -eq 5 ]
   then
      break
   fi
   a=`expr $a + 1`
done

Open in new window

from below link
https://www.tutorialspoint.com/unix/unix-loop-control.htm

i am not sure how to execute in baboon software

Babun
http://babun.github.io/


cygwin i am not able to install as it gives error not able to find download sites as attached.

any good graphical user interface tool to run these unix shell scripts
what is best site to know about these scripts
baboonErr.png
cygwinErr.png
LVL 7
gudii9Asked:
Who is Participating?
 
Carlos IjalbaConnect With a Mentor Senior SysadminCommented:
You can also download the MobaXterm Personal Edition, that works fine, as it integrates cygwin and busybox in a local terminal session:

[2016-10-22 18:10.03]  ~
[Carlos.Workstation] ➤ /bin/sh
[2016-10-22 18:10.13]  ~
[Carlos.Workstation] ➤ a=0
[2016-10-22 18:10.13]  ~
[Carlos.Workstation] ➤ while [ $a -lt 10 ]
> do
>    echo $a
>    if [ $a -eq 5 ]
>    then
>       break
>    fi
>    a=`expr $a + 1`
> done
0
1
2
3
4
5

Plus it is also a session SSH, RDP, FTP, HTML manager, very handy:

http://mobaxterm.mobatek.net/
0
 
Thomas WheelerConnect With a Mentor Commented:
I would use cygwin. Just add one of the mirror sites to the list and install
Mirror Sites
0
 
Gerwin Jansen, EE MVEConnect With a Mentor Topic Advisor Commented:
Or install VMware player and then run a virtual Linux installation. Much better than cygwin.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
gudii9Author Commented:
i tried mirro site b`````````elow

United States:

California: mirrors.kernel.org(ftp)

did not work please advise
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
I try mirror sites every day. You have to tell us what you tried or we won't be able to help you further.

Just go here and select the 32 or 64 bit installer: https://cygwin.com/install.html
0
 
gudii9Author Commented:
error is as atached.

how to verify outside cygwin whether mirror site works or not like ping etc from my windows laptop
cygwinAdd1.png
cygwinAdd2.png
cygwinAdd3.png
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
You do not have a working internet connection or a firewall / antivirus application that is blocking the cygwin setup to connect to the internet to get the setup files. You have to fix that first. Or get VMware and install Linux in a VM :)
0
 
gudii9Author Commented:
can i download offline copy  of cygniw to download and to install to avoid these firewall related issues

not sure how to  get VMware and install Linux in a VM ? any link for that?\
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
>> can i download offline copy  of cygniw to download and to install to avoid these firewall related issues
Not that I know of, fixing your issue would be better anyway.

VMware Player: https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_workstation_player/12_0

Prebuilt Linux VM's are here, for example Fedora: http://www.osboxes.org/fedora/
0
 
serialbandConnect With a Mentor Commented:
There was a major DNS DDOS on DYN today.  If you were in the USA, then you would have had problems conecting to many major sites at the times of your post.  You should be able to connect now and update cygwin.

https://krebsonsecurity.com/2016/10/hacked-cameras-dvrs-powered-todays-massive-internet-outage/
1
 
gudii9Author Commented:
a=0

while [ $a -lt 10 ]
do
   echo $a
   if [ $a -eq 5 ]
   then
      break
   fi
   a=`expr $a + 1`
done

Open in new window


to run above we need execute separate

#!/bin/sh
then



while [ $a -lt 10 ]
do
   echo $a
   if [ $a -eq 5 ]
   then
      break
   fi
   a=`expr $a + 1`
done
0
 
gudii9Author Commented:
how baboon, cygwin and mobaXterm are different or similar? which one to prefer?
0
 
gudii9Author Commented:
what are avantage and disadvantages of each?
0
 
gudii9Author Commented:
#!/bin/sh

a=0

while [ $a -lt 10 ]
do
   echo $a
   if [ $a -eq 5 ]
   then
      break
   fi
   a=`expr $a + 1`
done

Open in new window


i was able to copy paste whole above lines and got
1
2
3
4
5

what is first line do?
#!/bin/sh
0
 
gudii9Author Commented:
while running one scrpts says 401 error authorization error. not sure why

http://core.brc.iop.kcl.ac.uk/wp-content/uploads/2014/01/TutorialsZinaIbrahim.pdf
0
 
gudii9Author Commented:
unary operator expected
too many arguments errors coming??
please advise
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
>> to run above we need execute separate
That is a question?

>> how baboon, cygwin and mobaXterm are different or similar? which one to prefer?
Depends on your purpose. What do you want to do? Just practice? Then just pick one. When you want to use real bash or ksh functionality, just run a VM.

>> what is first line do?
You mean "What does the first line do?" - this is called a Shebang - basically, it tells the system to run your script (program) with that shell - https://en.wikipedia.org/wiki/Shebang_(Unix)

>> while running one scrpts says 401 error authorization error. not sure why
Simple - HTTP Error 401 means Unauthorized - you do not have access to that what you're trying to get

>> unary operator expected
Not too many, not enough arguments/parameters. Most likely a variable is empty. Post your full output so we can analyse.
0
 
Carlos IjalbaSenior SysadminCommented:
OK,

let's see, if what you want to try is linux from a windows box, then you can do a million things to do this, one is install cygwin, which is a port of linux utils for windows, other is install the old microsoft's unix environment for windows, another is install the ubuntu bash shell for windows 10, which has been developed by canonical & microsoft, etc.

However the easiest and fastest is to try MobaXterm, that's why I suggested it to you.

MobaXterm is a terminal connection manager that supports loads of functionalities and protocols, and that just happens to install and configure cygwin to be used as a local terminal session, and it also integrates busybox. But they are different things, MobaXterm doesn't have anything to do with cygwin, is like comparing microsoft's powershell with norton commander.

If you want to install cygwin, and configure it, then go ahead, but you will need to know a few basics first, therefore:
Better to try MobaXTerm first, and save yourself some trouble.

For the rest of the questions, they should go to another linux/unix questions, this one has been resolved, Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.