problem about ksh-Collection of common programming errors


  • asc99c
    c linux ubuntu ksh
    I’ve got a fairly well tested bit of an application I’m trying to get working on Ubuntu Linux, and having a lot of problems, seemingly with the ksh implementation. The problem seems to manifest when it is being called by the system build command.There is a ksh script which auto-generates a C header file from a C source file. When I try to run it via a system() call in a C application, the ksh crashes with a segfault.At the command line, I can run the command without problems, and it works corr

  • Chris Aldrich
    shell-script ksh error-handling
    I am a database administrator working with DB2 on AIX. (Please continue to read as this is related more to ksh than DB2, otherwise I would have posted this over on dba.stackexchange.com.) I am attempting to write up ksh scripts for several of our database deployment as well as database maintenance scripts.I am in the process of putting error handling in our scripts to know whether or not something requires a hard fail or just a warning message, or can be ignored.With most AIX/ksh related tasks I

  • rahmu
    solaris ksh file-descriptors ulimit
    I’m working on an old legacy application, and I commonly come across certain settings that no one around cam explain.Apparently at some point, some processes in the application were hitting the max number of files descriptors allowed per process, and the then team decided to increase the limit by adding the following to the init files of their shells (.kshrc):((nfd=16#$(/etc/sysdef | grep “file descriptor” | awk ‘{ print $1 }’ | cut -f3 -d “x”)))ulimit -n $nfdThis increases the output of ulimit

  • Chris J. Kiick
    ksh
    I have a program that crashes. I know it does, it’s supposed to in order to test some trap handling. The crash is expected behavior.When I run the program from ksh, the shell insists on printing helpful little messages like:./fpe.ksh: line 9: 105778: Floating exceptionHow do I make it stop that? I want the shell script to ignore the crash and keep going, without the error message.

  • Andrew G.
    linux shell unix ksh cat
    I used the following command in my unix box.$ cat kshAnd it gave a rolling log of latin and greek letters and symbols and it kept on going with no signs of stopping. Eventually I had to close my connection tool to stop it.I was just wondering what was it displaying?

  • Dave
    solaris unix-shell ksh
    Our outsourced IT service provider runs the following script via cron to clean up Oracle core and trace files. It clearly is not a well-written script, but my question for the Serverfault crowd is whether there is an error or boundary condition that would have it remove other directories, such as these: /ora/admin/SCRM01P/bdump /ora/admin/SCRM01P/cdump /ora/admin/SCRM01P/pfile /ora/admin/SCRM01P/udumpWe recently had these directories deleted on a production system, crashing Oracle. Have a loo

  • Gilles
    bash ksh error exit error-handling
    Similarly to set -e performs an exit on “uncaught” $? != 0, I’d like to have this event trigger the execution of another command, e.g. a logger call. How can this be done?

  • l0b0
    shell ksh
    As per my knowledge, to determine the current shell we use echo $0 in the shell. Rather I want my script to check in which shell it is running. So, I tried to print $0 in the script and it returns the name of the script as it should. So, my question is how can I find which shell is my script running in during runtime?

  • Henk Langeveld
    shell script classpath ksh
    I have to execute the below scriptexport CPATH=”cpath=.:/mdcode/mtrxmdsb2/WaferChecks/bin/WaferChecksFile.jar” /sail/lpp/IBM/Java/1.6.0/jre/bin/java \-classpath “$CPATH” com/ibm/md/waferchecks/ReadPasswordMain $1 $2 $3The script accepts 3 arguments. But when im running the script from the cmd prompt, I am getting the following error:Exception in thread “main” java.lang.NoClassDefFoundError: com.ibm.md.wafercheck s.ReadPasswordMain Caused by: java.lang.ClassNotFoundException: com.ibm.md.waferchec

  • Henk Langeveld
    windows cygwin ksh
    Always i get “Source file not readable or exists, please check the file ” for the below code. I use cygwin in my windows machine to run the script. I am getting the same message even when the file is present in the location. How can i get more details as why the file is not readable.#!/bin/ksh # # Scanning source file for existance and readable file_loc=”abc.xml” if [ -f “$file_loc” -a -r “$file_loc”] thenprint “Source file read.\n” elseprint “Source file not readable or exists, please check the

  • 4 revs, 2 users 100%Nano Taboada
    java unix jsp shell ksh
    First and foremost I should acknowledge that I have no experience at all using Java ServerPages, but I’m positive about achieving this task if you guys help me out a bit since it doesn’t seem like something difficult for a seasoned JSP programmer.Anyway the thing is, there’s an actual running JSP application within a *NIX box which I somewhat administer with kind of good permissions. The idea is to create a new but dead simple JSP page to control some Korn Shell scripts I’ve got running there. S

  • Bert F
    bash unix shell ksh
    i am testing with the shell script below:#!/bin/ksh -xinstance=`echo $1 | cut -d= -f2` if [ $instance == “ALL” ] then echo “strings matched \n” fiIt’s giving this error in the if condition:: ==: unknown test operatoris == really not the correct syntax to use? I am running on the command line as belowtest_lsn_2 INSTANCE=ALLCould anybody please suggest a solution. Thanks.

  • dsolimano
    ksh sua
    I am using SUA-Korn shell on Windows where in I have set an alias in .profile as alias sqlplus=’sqlplus.exe’So when I start SUA-Korn shell and run sqlplus it calls sqlplus.exe and works fine but when I put same command in .ksh file and run it gives error that ‘unknown command sqlplus’ Below is .ksh file#!/bin/ksh sqlplus main/main@SID9 @script.sqlIf I execute above test.ksh in SUA-Korn shell as. test.ksh then it works fine buttest.kshgives unknown command sqlplus.Thanks In Advance

  • Bernard Assaf
    ksh readonly typeset
    I wish to source a script, print the value of a variable this script defines, and then have this value be assigned to a variable on the command line with command substitution wrapping the source/print commands. This works on ksh88 but not on ksh93 and I am wondering why.$ cat typeset_err.ksh #!/bin/ksh unset _typeset_var typeset -i -r _typeset_var=1 DIR=init # this is the variable I want to printWhen run on ksh88 (in this case, an AIX 6.1 box), the output is as follows:$ A=$(. ./typeset_err.ksh