Reputation: 8626
I am just getting started with BASH scripting and have run into a problem.
I am trying to output the value of a variable and whilst I can achieve this via the echo
command. When I try to use the print
command I see an error.
Here is the problem when trying to use the print
command:
ian@ian-VirtualBox:~$ y=$HOME
ian@ian-VirtualBox:~$ print -- $y
**Warning: unknown mime-type for "/home/ian" -- using "application/octet-stream"
Error: no "print" mailcap rules found for type "application/octet-stream"**
.. and here is the output using echo
ian@ian-VirtualBox:~$ echo $HOME
/home/ian
Is the print
command not supported? or is there an issue with my environment?
In case of need I am using Xubuntu 12.10
Update following responses\feedback:
What do I expect print
to do?
Output the value of the variable as the echo command does.
Why am I expecting this behavior?
The examples I have been referring to use print as I have in my example above. I don't get any output just the error. So I wanted to know why this error is happening.
The examples that I have to hand are using the Korn Shell. I appreciate that I am using the BASH shell but in my naivety I thought it should work.
Upvotes: 0
Views: 2050
Reputation: 77187
print
is not a standard shell command. Are you thinking of printf
?
It might serve you to get started by reading a shell scripting guide.
(The print
command you have on your system looks like it's for printing a file, not displaying the expansion of a name.)
Upvotes: 4