Solved

unix example issues

Posted on 2016-10-21
18
70 Views
Last Modified: 2016-10-29
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
0
Comment
Question by:gudii9
  • 9
  • 5
  • 2
  • +2
18 Comments
 
LVL 7

Assisted Solution

by:Thomas Wheeler
Thomas Wheeler earned 83 total points
ID: 41854400
I would use cygwin. Just add one of the mirror sites to the list and install
Mirror Sites
0
 
LVL 37

Assisted Solution

by:Gerwin Jansen
Gerwin Jansen earned 83 total points
ID: 41854408
Or install VMware player and then run a virtual Linux installation. Much better than cygwin.
0
 
LVL 7

Author Comment

by:gudii9
ID: 41854441
i tried mirro site b`````````elow

United States:

California: mirrors.kernel.org(ftp)

did not work please advise
0
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 41854445
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
 
LVL 7

Author Comment

by:gudii9
ID: 41854492
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
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 41854502
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
 
LVL 7

Author Comment

by:gudii9
ID: 41854505
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
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 41854559
>> 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
 
LVL 28

Assisted Solution

by:serialband
serialband earned 83 total points
ID: 41854842
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 9

Accepted Solution

by:
Carlos Ijalba earned 251 total points
ID: 41855354
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
 
LVL 7

Author Comment

by:gudii9
ID: 41857463
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
 
LVL 7

Author Comment

by:gudii9
ID: 41857465
how baboon, cygwin and mobaXterm are different or similar? which one to prefer?
0
 
LVL 7

Author Comment

by:gudii9
ID: 41857467
what are avantage and disadvantages of each?
0
 
LVL 7

Author Comment

by:gudii9
ID: 41857471
#!/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
 
LVL 7

Author Comment

by:gudii9
ID: 41857495
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
 
LVL 7

Author Comment

by:gudii9
ID: 41857502
unary operator expected
too many arguments errors coming??
please advise
0
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 41859339
>> 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
 
LVL 9

Expert Comment

by:Carlos Ijalba
ID: 41865145
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now