1

I am tying to print a line " hello Everyone" Using echo I can print it like echo "hello Everyone" But when I replace echo with print like print " hello Everyone" I get error message.

Here's my prompt

niraj@niraj-VPCEB4L1E:~/Religion$ echo "hello world"
hello world
niraj@niraj-VPCEB4L1E:~/Religion$ print "hello world"
Warning: unknown mime-type for "hello world" -- using "application/octet-stream"
Error: no such file "hello world"
niraj@niraj-VPCEB4L1E:~/Religion$ ^C
  • I just did I am a starter with ubuntu and I was trying to just replace echo with print command. I just wanna know can we replace echo with print. – Narwen Nov 10 '13 at 12:35
3

You shouldn't use print from bash, but printf:

$ print "Hello"
Warning: unknown mime-type for "Hello" -- using "application/octet-stream"
Error: no such file "Hello"
$ printf "Hello\n"
Hello

print is an symbolic link to run-mailcap:

$ type print
print is hashed (/usr/bin/print)
$ ls -l /usr/bin/print
lrwxrwxrwx 1 root root 11 sep 18 14:02 /usr/bin/print -> run-mailcap

run-mailcap, view, see, edit, compose, print - execute programs via entries in the mailcap file

The see, edit, compose and print versions are just aliases that default to the view, edit, compose, and print actions (respectively).

That's why you get errors.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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