Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Jun 2020 04:27:20 -0700
From:      Donald Wilde <dwilde1@gmail.com>
To:        Michael Schuster <michaelsprivate@gmail.com>
Cc:        "Brenda J. Butler" <bjb@sourcerer.ca>, freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: Mininal skills
Message-ID:  <CAEC73907pTMW1LE2=WQCX%2B-sa0ivPf7141xFWOyurdHdJ5g0Cg@mail.gmail.com>
In-Reply-To: <CADqw_gJpjAOAL_VAsppqCQBJZixY=PCFFmkE7is6xJGX_U4BZQ@mail.gmail.com>
References:  <CY4PR19MB0104A2C03F4D66A1DA251A23F9880@CY4PR19MB0104.namprd19.prod.outlook.com> <CY4PR19MB0104E74C96FDA086AF18C0F8F9890@CY4PR19MB0104.namprd19.prod.outlook.com> <CY4PR19MB01040BA77657FD7AB1D0B1E9F9890@CY4PR19MB0104.namprd19.prod.outlook.com> <20200605062217.cjtkdgwqwqqienct@blueeyes.stuffed.animals> <CADqw_gJpjAOAL_VAsppqCQBJZixY=PCFFmkE7is6xJGX_U4BZQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 6/4/20, Michael Schuster <michaelsprivate@gmail.com> wrote:
> On Fri, Jun 5, 2020 at 8:22 AM Brenda J. Butler <bjb@sourcerer.ca> wrote:
>
>>
>> As for "what is shell programming" ... it's the same as regular
>> programming
>> but written in a language that doesn't need to be compiled.  Often the
>> shell program calls on other programs to do the work.  So learning "shell
>> programming" is about more than learning the shell language - it is
>> also about learning enough of those other little utilities to be
>> able to do something useful in the shell.
>>
>
> One of the best books on the subject (in my experience) is "The Unix
> Programming Environment" by Kernighan and Pike - written in 1984, it is
> still a good text to teach you some of the fundamentals of the ... unix
> programming environment ;-).
> I highly recommend it.
[snip]

I agree! Very good book! Another good one is 'UNIX Network
Programming' by Stevens, and soon enough you'll be ready for 'Advanced
Programming in the UNIX Environment', also by Stevens (Sorry, I'm a
'dead tree' addict!).


One important thing to add in regards to program execution -- covered
in the books but deserves mention so you can get going faster .

While compiled binaries on 'NIX systems like FreeBSD are distributed
in ELF format (which you can look up if you are interested), files
intended for a scripting language such as a shell have a very special
sequence of characters the shell looks for at the beginning: '#!',
also called 'she-bang'.  These MUST be the first two characters in the
text file, followed by the location of the program you want to use to
execute the file, such as '#!/usr/local/bin/ruby27' for the latest
version of Ruby. You can also specify a different shell binary as your
program. For example, I execute a file with '#!/bin/sh' with the
simple Bourne shell 'sh' from my root prompt when root's normal shell
(on FreeBSD) is tcsh. The syntax of each shell's language is somewhat
different, so take care. Just dive in with your text editor, create a
few files, and try to run them. If you haven't already, use 'chmod + x
myfile' to make them run directly from the prompt, like:

     ./myscript

the period-slash combo tells your shell that the current directory is
where to find that file; otherwise, it'll merrily look for your
program in /bin, /usr/bin, etc.
-- 
Don Wilde
****************************************************
* What is the Internet of Things but a system *
* of systems including humans?                     *
****************************************************



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAEC73907pTMW1LE2=WQCX%2B-sa0ivPf7141xFWOyurdHdJ5g0Cg>