1

While running my program I found the following errors

today.ksh[36]: test: 0403-004 Specify a parameter with this command.
sed: 0602-419 Cannot find or open file /home/tmp/filename.
today.ksh[37]: test: 0403-004 Specify a parameter with this command.
today.ksh[24]: test: 0403-021 A ] character is missing.

but I am unable to understand meaning of following:

  • sed:0602-419 what means by 0602-419 ?
  • today.ksh[37] what is 37 indicates ? and test: 0403-004 what it means?

    In short the numbers range like 'test: 0403-004' that is getting displayed what they mean ? how it can be useful while debugging in ksh?

4
  • number between bracket [] represent line number of script file, in that case today.ksh[37] open file today.ksh at line 37. (vi +37 today.ksh)
    – Archemar
    Apr 2, 2015 at 11:41
  • @Archemar At line 37 in Ksh I have declared a variable which is not related to it.
    – Aman
    Apr 2, 2015 at 11:45
  • you can use ksh -x to have debugging, I guess from missing operand that you set a variable name foobar, then later use $fobar. Also, look first on line 24, it is often best to search earliest error.
    – Archemar
    Apr 2, 2015 at 11:54
  • @Arhemar suppose my ksh file name is today.ksh then should i run as ksh -x today.ksh on terminal
    – Aman
    Apr 2, 2015 at 12:17

1 Answer 1

1

Welcome to AIX.

On of the things that is ubiquitous in IBM operating systems is the idea that system messages all have identifying alphanumeric codes. The messages may be translated into different languages, but the codes stay the same. And there is usually, as part of IBM's documentation, a reference manual where one can go and look up these messages by their code.

On OS/2 and OS/400, codes take the form of a three-letter facility designator and a four-digit message number. (OS/2 users will remember things such as SYS0002, and the ability to look these codes up at the command line with the help and helpmsg commands.) On AIX they take the form of a four-digit operating system component number and a three-digit message number.

So 0403-004 is not a "range". It's a message code, for component number 0403 message number 004. Component 0403 is the Korn Shell. Component 0602 is the group of UNIX text editing tools: vi, ex, ed, sed, and awk.

And, yes, AIX has a big reference manual listing all of these codes.

However, it isn't exactly detailed in its treatment of the messages. (In comparison, the OS/2 help facility has a detailed description and action for most SYS messages seen at the command line.) Therefore:

  • 0403-004: You've most likely forgotten to put quotes around a variable expansion, resulting in it expanding to nothing when the variable is unset and hence a syntax error for the test command.
  • 0403-021: When invoked as [, the command requires that the final argument be a ]. Commonly, this error is the result of forgetting to make the final ] character a separate word on its own.

Further reading

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .