# Is there a command called print in Bourne shell?

**URL:** <https://community.unix.com/t/is-there-a-command-called-print-in-bourne-shell/387489>\
**Category:** HP-UX\
**Created:** [July 29, 2022, 4:40pm UTC](https://community.unix.com/t/is-there-a-command-called-print-in-bourne-shell/387489 "2022-07-29T16:40:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![r\_magoha](https://community.unix.com/user_avatar/community.unix.com/r_magoha/32/18994_2.png) [@r\_magoha](https://community.unix.com/u/r_magoha)\
**Post date:** [July 29, 2022, 4:40pm UTC](https://community.unix.com/t/is-there-a-command-called-print-in-bourne-shell/387489/1 "2022-07-29T16:40:09Z")

</div>

Environment : HP-UX (sorry ☺ )

Since I came across `print` command being used in shell scripts in this HP-UX server, I looked for `print` command in the command line.  
It turns out there is a `print` command in Bourne shell, at least in HP-UX.

But, I don't see `print` command in $PATH. It is not an alias either. `type` command's output says it is a shell builtin.

`echo $0` revealed that the shell is Bourne shell. So, is there a command called `print` in Bourne shell ?

```nohighlight
$ uname -a
HP-UX myhostname B.11.31 U ia64 2380116268 unlimited-user license

$ print hello world
hello world
$
$
$ ## It is not in $PATH
$ which print
no print in /usr/sbin /usr/bin /usr/ccs/bin /usr/contrib/bin . /opt/nedit-5.5-HPUX/bin /opt/cfg2html /opt/nettladm/bin /opt/fcms/bin /opt/wbem/bin /opt/wbem/sbin /opt/sas/bin /opt/wli/bin /opt/graphics/common/bin /opt/resmon/bin /usr/contrib/kwdb/bin /usr/bin/X11 /usr/contrib/bin/X11 /opt/prm/bin /opt/propplus/bin /opt/sfm/bin /opt/swm/bin /opt/ssh/bin /opt/hpsmh/bin /opt/firefox /usr/local/sbin /usr/local/lbin /usr/local/bin /opt/langtools/bin /opt/ignite/bin /opt/perf/bin /opt/dsau/bin /opt/dsau/sbin /opt/gvsd/bin /opt/ipf/bin /opt/hpvm/bin /opt/atok/bin /opt/sec_mgmt/bastille/bin /opt/caliper/bin /opt/drd/bin /etc/cmcluster/scripts/tkit/vtn /opt/perl_32/bin /opt/perl_64/bin /opt/sec_mgmt/spc/bin /opt/swa/bin /opt/thunderbird /opt/sentinel/bin /opt/wlm/bin /opt/gwlm/bin /sbin /root /opt/bin /opt/quest/bin /opt/oracle/base/admin/oramgr/bin /usr/local/bin /usr/local/lbin /usr/sbin /opt/iexpress /opt/oracle/agent/agent_inst/bin /opt/iexpress/curl/bin

# echo is in the $PATH though.
$ which echo
/usr/bin/echo

$
$ alias | grep -i print
vxprint=/usr/sbin/vxprint
$
$
$ type print
print is a shell builtin.
$
$ man print
No manual entry for print.
$
$ echo $0
-sh
$
$ echo $SHELL
/usr/bin/sh
$ file /usr/bin/sh
/usr/bin/sh: ELF-32 executable object file - IA64
$

```

---

<div class="post-metadata">

**Author:** ![MadeInGermany](https://community.unix.com/letter_avatar/madeingermany/32/6_22734026db12803ebb3e059622ac3534.png) [@MadeInGermany](https://community.unix.com/u/MadeInGermany)\
**Post date:** [July 29, 2022, 4:58pm UTC](https://community.unix.com/t/is-there-a-command-called-print-in-bourne-shell/387489/2 "2022-07-29T16:58:49Z")

</div>

`which` is a csh (and tcsh) builtin.  
So it can only find external commands (and csh builtins).  
I do not recommend `which` in other shells.  
`type` is a Bourne- and standard-shell builtin.  
`print` is a ksh builtin. In HP-UX /bin/sh is a link to ksh, therefore it works there, but this is not the case on other OS.  
Only Solaris (10 and older) has got the (old poor) Bourne shell. Usually /bin/sh is a Posix shell that is highly compatible with Bourne but more powerfull. On some Linux distros /bin/sh is a link to bash, that when called as sh is highly compatible with Posix shell.

---

<div class="post-metadata">

**Author:** ![drysdalk](https://community.unix.com/letter_avatar/drysdalk/32/6_22734026db12803ebb3e059622ac3534.png) [@drysdalk](https://community.unix.com/u/drysdalk)\
**Post date:** [July 30, 2022, 8:24am UTC](https://community.unix.com/t/is-there-a-command-called-print-in-bourne-shell/387489/3 "2022-07-30T08:24:09Z")

</div>

Hi,

One slight addendum to this: I believe that from version 10 onwards, the default shell in HP-UX is actually the POSIX shell. Prior to that, it was the Korn shell, as MadeInGermany rightly says. Since you're on 11.31 from the info you posted, I suspect that your `/bin/sh` is the POSIX shell, which is what HP switched to using a little while back as the default. But on HP-UX prior to 10.0, the default shell is indeed Korn.

---

<div class="post-metadata">

**Author:** ![MadeInGermany](https://community.unix.com/letter_avatar/madeingermany/32/6_22734026db12803ebb3e059622ac3534.png) [@MadeInGermany](https://community.unix.com/u/MadeInGermany)\
**Post date:** [July 30, 2022, 9:41am UTC](https://community.unix.com/t/is-there-a-command-called-print-in-bourne-shell/387489/4 "2022-07-30T09:41:16Z")

</div>

ITYM Bourne shell.?  
Korn shell is ksh.

ksh88 in sh mode was Posix certified. But is not a true psh.

---

<div class="post-metadata">

**Author:** ![system](https://community.unix.com/uploads/default/original/2X/c/c7e9e16a595259edafe88615719d5c5dcda035c2.png) [@system](https://community.unix.com/u/system)\
**Post date:** [August 9, 2022, 9:41am UTC](https://community.unix.com/t/is-there-a-command-called-print-in-bourne-shell/387489/5 "2022-08-09T09:41:59Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
