Im starting out to learn programming with unix,
and on my very first command echo, it's not
interpreting the options while using echo on my terminal
example:
echo --help
printing it as --help
echo -e Unix\bProgramming\tNovember
output: UnixbProgrammingtNovember
hi @gnash , welcome, do you know which OS you are using , if not, enter lsb_release -a at the terminal and share the response, likewise which 'shell' are you using , typing echo $SHELL or echo $0 at the prompt to show and share those outputs.
You should be aware of the man command, this displays usage information about commands, so to find out about the echo command enter man echo at the prompt.
man man explains how to use man and its various options.
I also recommend online searches , e.g. in your favourite browser
linux echo command examples
or
top twenty important linux commands to know
look for online free introduction courses on unix/linux , expect to do a lot of reading and experimenting, I cannot underestimate the benefit of online examples and using the man as you start this journey.
Are you learning unix as part of a job or for study ?
for the commands you've shared, try the following (enclose the text in " double quotes ! )
lsb_release -a works on Linux only (lsb = Linux Standard Base).
And some Linux distros don't install the lsb package by default.
The quotes prevent the shell from doing substitutions in command arguments.
And echo is a command.
There are different versions of echo with different options.
If portability matters you should get used to the printf command:
printf "%b\n" "Unix\bProgramming\tNovember"
The printf takes a format argument that tells how to interpret the following arguments. %b says interpret \ specially.
I have described that in detail on expert level:
Also be aware that you are probably not running the standard echo command. Almost every shell will have a built-in command echo which may be slightly different to the one in the man page (and to the echo in other shells).
$ type echo
echo is a shell builtin
$ type /bin/echo
/bin/echo is /bin/echo
$
thanks a lot @munkeHoller it's helpful and the enclosed text worked with options!
Im using Unix on an Old Mac of mine, it's bash-3.2$
I'm passionate about computers and would like to explore whats goin on in computers,
So I choose to learn Unix and its not for academics so im committed to it in long term
and most importantly Im strong willed to learn C and C++ for years with self-interest,
Since im new to computers,im exploring em with these classic C and Unix,
In this context,your community is a great means for self-learning
And thanks for your help, it worked so smooth!
@gnash, please, invest in yourself by reading the reference source(s) for all/any software you intend to use, a few hours spent going through those - combined with practical exercises will pay you handsomely.
You can find out more about built-ins from the resource below. In context the term built-ins means the command is an intrinsic part of the bash shell not a separate function/program that is invoked by the shell.
Luckily, in today's world you have the benefit of practically unlimited resources and hidden teams of 000's working on your behalf, ready, willing and able to provide you instant answers to almost any question posed ... one of the most popular is google search, simply type into the search dialog 'what's a built-in echo command? and you will see.