Question

want ksh for cygwin

Asked by: kayvey

if i get ls werking in cygwin i want to get it to run ksh anybody have a good setup site explanations
i will google but sometimes that is a rack fracker.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2004-02-09 at 19:05:09ID20879117
Tags

cygwin

Topic

Unix Setup

Participating Experts
3
Points
250
Comments
37

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. ksh and ls
    I would like to search a given directory and find all those files that weer modified within a certain date interval (ie. file's date > 1/1/2000 and file's date < 2/1/2000). I have looked at the options for ls and didn't see anything there. Do I need to pipe the result...
  2. ! nn and !! with ksh
    Hi all, Now I can use ksh from csh but I face another issues : - when I enter !! it raises ksh: !!: not found - when I want to reexecute a command under ksh e.g. : ! nn, it have : ksh: 114: not found. Thanks in advance.
  3. cygwin has no ls
    i am trying to install cygwin on my laptop with win 2k i got a bash prompt (would like ksh) but the ls gives the error command not found
  4. setting the startup shell to ksh
    okay.. now we are talking about this same .profile stuff as other posts of mine (like the knoppix one) okay.. now i don't know if it is easy to reference that material for you guys so i guess i better be sure to carefully describe things clearly. i have learned, that in o...
  5. Cygwin permissions on non-cygwin files (umask?)
    My umask is set properly in cygwin, when I create files they come out 644. But, when a non-cygwin program (say, my text editor) creates a file, cygwin decides it is 700. I want it to be 644. $ ls -l test* ls: test*: No such file or directory $ touch test.txt $ ls -l test*...
  6. arrays in ksh
    How do I stuff an int vanlue in an array and how do I stuff a string value in an array in ksh ??

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: yuzhPosted on 2004-02-10 at 00:43:56ID: 10320309

 

by: kayveyPosted on 2004-02-10 at 11:25:14ID: 10325226

my friend sent me a link here:

http://www.research.att.com/~gsf/download/tgz/ast-ksh.2003-07-24.cygwin.i386.tgz


it untarred okay.. now i have to like make make install or something right?  i guess
that's supposed to be in the README or something, right?  i'm not really comfortable
installing on unix yet.. i will get to this after i finish the assignment (which includes
getting cygwin but getting ksh was my own independent preference)

 

by: gheistPosted on 2004-02-10 at 16:06:30ID: 10327897

What about pdksh , using cygwin installer

 

by: kayveyPosted on 2004-02-10 at 18:23:28ID: 10328762

well if you give me a link for that maybe i will try it.. do you suggest that above the link i got from my friend
above?  ( .../download/...i386.tgz)

 

by: gheistPosted on 2004-02-10 at 22:54:15ID: 10329974

and again from another thread - bash is run from cygwin.bat, fix it by replacing bash with ash,ast or pdksh, after they get installed...
Linux uses bash2, freebsd uses tcsh, openbsd uses pdksh... most commercial unices use (older) ksh. All have older bourne shell (grandfather of ksh) for /bin/sh. It all depends where you will be using your scripts after.
ActiveState (www. ... .com) perl is better than one which comes with cygwin, I for my self consider FreeBSD 5.2 for laptop.

 

by: kayveyPosted on 2004-02-11 at 14:08:54ID: 10336801

okay  now i have an /etc/passwd in cygwin or not?  where would .profile be if i change my startup shell to ksh?

 

by: kayveyPosted on 2004-02-12 at 14:38:08ID: 10347600

okay now i did a nice set up and ksh is there.. but i changed the /etc/passwd entry but i still get bash

 

by: gheistPosted on 2004-02-12 at 22:26:18ID: 10349914

Do you read your other topic??? Can you take a complicated task of editing a batch file in windows ????

 

by: kayveyPosted on 2004-02-13 at 14:20:31ID: 10356753

i need to run cygwin because of the platform we have to work on.  this is for a class, but ksh is not required. i prefer
ksh.  now i finally installed cygwin correctly but right now i have to write a script to fix the case i don't know what
else to do the make command is not working because it doesn't read any directories.

oh.. now.. okay.. so if i update the file cygwin.bat that will be my startup shell?  okay i will try that and update.
i have a ksh now that i installed cygwin correctly.

 

by: kayveyPosted on 2004-02-13 at 14:39:53ID: 10356901

i went to bin, and there is only ksh.exe i ran it from windows explorer it
fired up but my .profile didn't get activated.  i tried changing
cygwin.bat like this:

it was:

@echo off

C:
chidir C:\cygwin\bin

bash --login -i


i left the first three lines but then i

#bash --login -i
ksh.exe --login -i


that's probably not right.. i don't know if --login is right for ksh

 

by: kayveyPosted on 2004-02-13 at 14:44:57ID: 10356950

okay i tried again replacing "bash" with "pdksh"
but the window only lives for a split second.

 

by: kayveyPosted on 2004-02-13 at 14:46:53ID: 10356969

btw that is how replacing "bash" with "ksh.exe" behaved too..
but i can run ksh.exe from the winders explorer but it doesn't
boot up my .profile correctly.

i put  set -o vi into my .bash_profile and i am almost feeling
satisfied, but can  bash display the cwd as the prompt too?

 

by: gheistPosted on 2004-02-13 at 22:59:27ID: 10359351

Just because pdksh is not a GNU software, it does not accept anything like --login, correct optiona would be pdksh -l -i

 

by: kayveyPosted on 2004-02-15 at 14:01:04ID: 10367441

KEWL!  yeah.. i'm sorry i didn't do a man for the correct -l thing.. it's werking now.. but i thought of one
more thing..

there isn't such a thing as a cygwin window that i could cut and paste from, is there?   that would be
really nice.

 

by: kayveyPosted on 2004-02-15 at 16:35:41ID: 10368171

my friend told me i have to fire up a sshd to use ssh to run my cygwin shell but he didn't have time to deal
with it.  that way i can use my ssh secure shell to run my cygwin shell because i just realized i am having
that (@*#ing vi buffering problem i just can't tolerate it.

we'll see what's faster.. you, tom, or a google search {:}

btw thanks a lot for the help and sorry i am such an idiot {:)

 

by: kayveyPosted on 2004-02-15 at 17:23:33ID: 10368396

everything werks now but i have another question.. am i going to have to
resetup everything every time i reboot.. i.e...



Now, you'll want to configure sshd.
Run "ssh-host-config -y" to set it up. This step will create necessary configuration files, a priviledge separation user and necessary directories. When prompted with "CYGWIN=" type "tty ntsec".


Now you are ready to start the service: "cygrunsrv -S sshd"


Test the service by running "ssh localhost"


and the the other thing that setup told me to do?

if so, how do i get this stuf in the startup?  if i put it in .profile i don't think
that would werk becuase i have to have sshd before i log in and run .profile

so where can i put it.. oh  cygwin.bat?  wait it won't be in the same process,
then will it?  

okay.  i am stumped.

 

by: TintinPosted on 2004-05-09 at 20:10:53ID: 11028132

Answer this fundamental question:

What particular feature/function/quirk of ksh that bash doesn't have, do you require?  99% of the time, people who ask this question just aren't aware that bash can be made to operate in a very, very similar mode to ksh.

 

by: kayveyPosted on 2004-05-09 at 20:28:19ID: 11028184

the pwd is the command line  (i never type "pwd" and if somebody does it is sort of confusing because
it looks just like the prompt but the prompt just has another ">"

 and i want to use the vi editor at the command line.. i hit esc, then k  and it
shows me my last command i keep hitting k and then it shows the last command and i can
do "l' or "w" and nagivate and re-edit the command e.g. turning a cp into a vi on the same
file etc.

 

by: TintinPosted on 2004-05-09 at 21:34:41ID: 11028406

You've just confirmed my suspicion.

Having the current working directory in the prompt works the same way for bash/ksh, eg:

export PS1='$PWD$ '

If you prefer using vi command edit mode, you set it in exactly the same way as you do for ksh, eg:

set -o vi

So far, there's absolutely no differences.

 

by: kayveyPosted on 2004-05-10 at 09:46:00ID: 11032793

set -o vi doesn't seem to stick on bash.

how would i make an if statement in my .profile so that it can react to the fact that it might
be running either bash or ksh?  right now, the .profile is on like a samba account or something
if i remote login (e.g. for my email) via a terminal/ssh to the unicorn server i have ksh but
when i try to run cygwin on a local samba netwerked thing it must run bash and it pulls
the same .profile.  i need to put if statements there somewhere because the bash shell gets ****ed up.l


hmm.. maybe i should send you the file.  do you have an email address?  it's a really big file
i got it from a instructor i don't know what it all does i guess i could figure it out but
i don't really know what parts of it makes the bash shell crash.

 

by: gheistPosted on 2004-05-10 at 10:41:50ID: 11033330

How about real UNIX ???
How about stopping the dream of tools you cannot have???

 

by: kayveyPosted on 2004-05-10 at 10:53:38ID: 11033439

what the hell are you talking about??

listen.  i don't have the money for 5 computers so i can run one on linux and one on bsd and
another on uncle bill suck my dick because i have an application called chessbase that is
very important to me.

i use a server that is an academic server called unicorn for email that is a real unix and i
am sorry to say all this nonsense with the cygwin is required for a course i am in  it will
be over soon maybe it is irrelevant but i am sorry ksh is real unix and well.. i don't
know is linux bsd bash real unix?  huh?  what is yer definition of "real unix" anyway...


if you ask me, having a .profile that is capable of handling the fact that it might be run
by either the ksh or the bash shell   to me seems like more than "real unix" it sounds
like a "real professional" idea.  hopefully someday over the rainbow i can be viewed
as skilled enuf to actually make a living at this but as of right now i guess these things are unclear.

for right now the only unices i can control are as a mere user on my academic accounts and
the cygwin running on my laptop i got for $30 (all i can afford) and the skewl samba netwerk
machines that have this strange configuration where the unicorn unix home directories for
users is mapped to an h drive for the xp and has cygwin on it that also uses the .profile
that resides on the unicorn/h drive server.

 

by: gheistPosted on 2004-05-10 at 12:41:02ID: 11034465

But you had money for 4 Windows. So you can have microsoft services for unix ( www.microsoft.com/unix ) , they install ksh without asking, unlike cygwin, where you need click through to get to pdksh... it was and is and will be matter of your choice.

 

by: kayveyPosted on 2004-05-10 at 13:47:52ID: 11035035

the point is i need my .profile to operate under both bash and ksh.  that is my current goal.  

 

by: kayveyPosted on 2004-05-10 at 14:01:39ID: 11035128

you fail to realize the sitch here.  i _cannot_ change the bash shell on the university xp/samba/cygwin set up.
therefore i have decided the best solution is to engineer my .profile to operate correctly under both ksh and bash.
this week i may need to use those machines because i don't have a floppy drive here and i am required
to create a floppy disk to interface with a hardware project.  in any case, it seems a professional type thing to
be able to do and i want to figure it out.

maybe i can do this....

oh sheesh.. is this the best way?

http://unix.about.com/library/weekly/aa092500a.htm

okay.. this should werk:

       A  shell  is  interactive  if the -i option is used or if both standard
/home/Kayven Riese>  
/home/Kayven Riese> ps
      PID    PPID    PGID     WINPID  TTY  UID    STIME COMMAND
     1144    1816    1144       1228    0 1000 13:52:39 /usr/bin/pdksh
     1936    1144    1936        460    0 1000 13:56:25 /usr/bin/ps
/home/Kayven Riese> ps | grep "ksh"
     1144    1816    1144       1228    0 1000 13:52:39 /usr/bin/pdksh
     1944    1144    1868       1944    0 1000 13:56:45 /usr/bin/pdksh
/home/Kayven Riese> ps | grep "bash"
/home/Kayven Riese> echo $?
1
/home/Kayven Riese> ps | grep "ksh"
     1144    1816    1144       1228    0 1000 13:52:39 /usr/bin/pdksh
/home/Kayven Riese> echo $?
0
/home/Kayven Riese>


here is a splat of the beginning of my .profile:

HISTFILE=~/.hist$$
MYSQL=/tmp/local/mysql/bin/mysql
HOST=63.195.122.251
PASSWD=cis167p1054
DATABASE=$LOGNAME
alias mysql="$MYSQL -u $LOGNAME -h $HOST -p${PASSWD} $DATABASE"
export PATH
export TERM=vt100
EXINIT='set aw sm smd'; export EXINIT
stty -tabs erase ^H  stop ^S intr ^C
stty kill ^K
stty susp ^Z
#tset -I -Q
PS1='$PWD> '
PS2='>'
PS3="Select: "
PS4='(Trace $LINENO): '
EDITOR=$(whence vi)
VISUAL=$(whence vi)
HISTSIZE=128
export PS1 PS2 PS3 PS4 EDITOR VISUAL HISTSIZE
export CFLAG="-s -O"


what is it in there that is messing up my bash shell?

i need to add something like:

what_shell=`ps | grep "bash"`
if [ $? -ne 0 ]

     don't mess up my bash shell get out of here.

    do i exit?
fi


shoot: why is this at the end:


#export DISPLAY=$(set_display)
exec /bin/ksh
set -o vi
set -o viraw



okay i am noticing:

You've just confirmed my suspicion.

Having the current working directory in the prompt works the same way for bash/ksh, eg:

export PS1='$PWD$ '

my .profile does this but it doesn't werk.  it also does set -o vi but it makes the bash shell puke

i think it might be this junk:

#####################################aliases####################################
alias -x a=alias -x
alias -x h='fc -l'
alias -x l=ls
alias -x ll='ls -l'
alias -x lll='ls -lt | head -15'
alias -x os='uname -a'
alias -x xt='xterm -fn courR14 &'
alias -x xtb='xterm -bg black -fg green -fn courR14 &'
alias -x sd='ls -l | grep "^d" '
alias -x vw='view'
alias -x bye='clear; exit'
alias -x av='appletviewer'
alias -x cls='clear'


is alias a command in bash?  i think that is what i see in the error messages




 

by: kayveyPosted on 2004-05-10 at 14:02:32ID: 11035139

btw

You are successfully logged in to this server!!!
/home/Kayven Riese> ps
      PID    PPID    PGID     WINPID  TTY  UID    STIME COMMAND
     1228     904    1228       1884    0 1000 14:01:12 /usr/bin/pdksh
     1520    1228    1520       1992    0 1000 14:01:22 /usr/bin/vim
      460    1704     460       1556    1 1000 14:03:48 /usr/bin/pdksh
      680     460     680        976    1 1000 14:03:52 /usr/bin/ps
/home/Kayven Riese>

 

by: kayveyPosted on 2004-05-10 at 14:22:08ID: 11035299

oh rats.. what'd i do?

what_shell=`ps | grep "bash"`
if ["$?" -ne 0 ]; then
    what_shell="bash"
else
    what_shell="not_bash"
fi   # this is line 28 of .profile i don't get that error
HISTFILE=~/.hist$$

Last login: Mon May 10 14:20:09 2004 from 127.0.0.1
Fanfare!!!
You are successfully logged in to this server!!!
ksh: /home/Kayven Riese/.profile[28]: [1: not found
/home/Kayven Riese>





oh well.. enough for today  i need to make my choo choo run to avoid getting a C

 

by: TintinPosted on 2004-05-10 at 14:30:40ID: 11035348

kayvey.

How about you watch your language.  There's no need for abusive terms.

Unless you have some *very*, *very* specific ksh'isms in your .profile, you should not need to change anything at all for it to work between ksh/bash.

What error messages do you get when your cygwin bash session reads your .profile?

 

by: kayveyPosted on 2004-05-10 at 14:59:42ID: 11035523

i can't cut and paste from there and i can't log on today and i don't believe in prejudice about this
nonsense having to do with "language"

 

by: kayveyPosted on 2004-05-10 at 15:03:11ID: 11035539

is there3 a way to cut and paste from a bare bones uncle bill cmd prompt or that similar looking default cygwin thing?

 

by: kayveyPosted on 2004-05-10 at 15:10:11ID: 11035567

 

by: TintinPosted on 2004-05-10 at 16:15:30ID: 11035871

OK, now we have concrete information to work on.  Your profile does indeed have some minor ksh/bash differences.

bash doesn't have a 'whence' builtin, so where you have

EDITOR=$(whence vi)

you could have

EDITOR=$(which vi)

although your milage can vary with the which command.

bash doesn't have exported aliases, so where you have

alias -x cls='clear'

do

alias cls='clear'

Do you really need exported aliases anyway?

To test which shell you are using, do

case $0 in
ksh)  echo "running ksh" ;;
bash) echo "running bash" ;;
*)      echo "unknown shell" ;;
esac

 

by: yuzhPosted on 2004-07-05 at 19:00:52ID: 11477145

at least gheist & Tintin should get the points.
 
 

 

by: gheistPosted on 2004-07-12 at 02:50:07ID: 11527656

fair enough

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...