{ 8 comments… read them below or add one }

1 Chris F.A. Johnson March 3, 2010 at 11:09 am

There is no good reason to use an external command (which) to find the location of a shell or any other executable file. Bash, like all Bourne-type shells, has the builtin command ‘type’.

If the command is a function or an alias, ‘which’ will not tell you that; ‘type’ will.

2 Chris F.A. Johnson March 3, 2010 at 11:14 am

Re: echo -e “Kernel Details: ” `uname -smr`

Command substitution is slow and, in this case, unnecessary.

Using ‘echo’ (which I don’t recommend) you could do:

echo -n “Kernel Details: ”
uname -smr

I rarely use echo because of portability problems; printf is universal:

printf “Kernel Details: ”
uname -smr

3 vasiauvi March 6, 2010 at 3:41 am

Thanks for this tutorial and wait the next one about bash scripting.

P.S. It would be nice if there where on your site option to save this kind of tutorials in pdf mode…I know there are addons for this but it’s an idea to implement directly in the site!

have a nice weekend!

4 Chris F.A. Johnson March 6, 2010 at 4:39 pm

man bash:

For almost every purpose, aliases are superseded by shell functions.

5 dfsdfsd March 7, 2010 at 6:38 am

Good post!

6 Michael Fread April 7, 2014 at 12:07 pm

This is a little sparse on content to qualify as a bash tutorial. You aren’t going to be able to do much without at least having conditionals and loops.

7 Chris F.A. Johnson April 9, 2014 at 4:03 pm

Michael, this is just an introduction, and they “will be posting several articles on Bash scripting”.

8 Logan Bender June 19, 2014 at 9:58 am

It is unclear in example 1. step 1 that the first line of the example script “$ cat helloworld.sh ” is actually the filename of the script and is not to be included in the actual body of the script. As an introduction, such distinctions should be made.

Leave a Comment

Previous post:

Next post: