Skip to main content


Showing posts from April, 2011

Play with Kornshell

Create test.ksh file #!/bin/ksh echo inout yes or no read answer case $answer in yes|Yes|y) echo got a positive answer #the following ';;' is mandatory for every set #of comparative xxx) that you do ;; no) echo got a 'no' ! ':(' ;; q*|Q*) #assume the user wants to quit exit ;; *) echo This is the default clause ;; esac Make sure you write #!/bin/ksh at the top  of your file I use this to give permission > chmod 0755 test.ksh Run the file >./test.ksh > ksh: ./test.ksh:  not found  <-- upps I got this error So I try use this command >ksh test.ksh > test.ksh[2]: ^M:  not found   <--- upp this error meaning something to do with space Use dos2unix, >dos2unix -437 test.ksh test1.ksh >dos2unix -437 test1.ksh test.ksh   -437 is use to avoid this error could not open /dev/kbd to get keyboard type US keyboard assumed could not get keyboard type US keyboard assumed After this ma