Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

From the korn shell, I keep getting print command not found. When I run print from the shell, it says the same thing. How would I go about fixing this? printf works fine, but for some reason print is not.

This is redhat 5.5 and the ksh is 3.2.25-release.

Thanks

share|improve this question
3  
Are you sure the print command does what you think it does? On my Debian system, it's a symlink to run-mailcap from the mime-support package. –  jordanm Oct 8 '12 at 17:50

2 Answers 2

up vote 0 down vote accepted

Could we have a little more information, please? "print" is a shell built-in function for ksh, and it should always be there. Here's some information from my own redhat system:

$ cat /etc/redhat\-release 
Red Hat Enterprise Linux Workstation release 6.3 (Santiago)

$ /bin/ksh --version
version         sh (AT&T Research) 93t+ 2010-06-21

$ whence -v print
print is a shell builtin

You might also check to see that you have no aliases named "print". I don't have any executables named "print" in /usr/bin, or /bin, etc. You might check whether that is also true for you. Start a new instance of the shell (type "/bin/ksh") and then say

PATH= whence -v print
share|improve this answer
    
it is "GNU bash, version 3.2.5(1)-release (x86_64-redhat-linux-gnu)", I just noticed it says GNU bash. It looks like some how it created a symlink to that. Not sure why. –  Matt Oct 8 '12 at 20:35

There's no such version of ksh. This is the version of bash on RHEL 5.5, however, so it looks like you're using bash. Are you looking for the ksh builtin? Use echo or printf instead. Or run ksh (which might not be installed, bash is the de facto standard shell on non-embedded Linux installations).

Here's a guide to translation print options to POSIX-compliant printf.

  • No option or -e: printf '%b\n'
  • With -n: omit \n from the format (printf %b or printf %s)
  • -p: if you need coprocesses, you need ksh
  • With -r or -R: printf '%s\n'
  • -s: redirect to the desired output file explicitly, with >> for appending
  • -u: use redirection, e.g. printf … >&3
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.