Follow-up: MFS Meeting. Tue, 16 July "Chat on Programming"
Michael Dorrington <[email protected]> Tue, 13 Aug 2019 18:25:09 +0100
| Newsgroups | gmane.politics.software.free-software.manchester,gmane.org.fsf.uk |
|---|---|
| Message-ID | <[email protected]> |
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --===============0518341840516648458== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="fCqXmwr1fc6Ro3kYZ8vpR2eniKV9TL8IH" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --fCqXmwr1fc6Ro3kYZ8vpR2eniKV9TL8IH Content-Type: multipart/mixed; boundary="jTQnPZUAoBwnzLBojDKjR5I6xyvHs1xQz"; protected-headers="v1" From: Michael Dorrington <[email protected]> To: Manchester Free Software <[email protected]> Cc: Free Software and the United Kingdom <fsfe-uk-mXXj517/[email protected]> Message-ID: <6c147253-2296-fbab-aeb4-f5b38121e3bb-IGUgQLVVQiRCV4ILt04nZQ@public.gmane.org> Subject: Follow-up: MFS Meeting. Tue, 16 July "Chat on Programming" References: <23aa4ea7-f113-6924-ad7b-e0e2fbef8a04-IGUgQLVVQiRCV4ILt04nZQ@public.gmane.org> In-Reply-To: <23aa4ea7-f113-6924-ad7b-e0e2fbef8a04-IGUgQLVVQiRCV4ILt04nZQ@public.gmane.org> --jTQnPZUAoBwnzLBojDKjR5I6xyvHs1xQz Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: quoted-printable On 12/07/2019 09:00, Michael Dorrington wrote: > * Event: Manchester Free Software's July Meeting > * What: Chat on Programming Hopefully the meeting helped people at least get an appreciation of programming. If you can type commands on the command line and use a text editor then you can create a shell script. In the simplest, you can just put the commands in a text file and run them by doing: bash your_file_with_commands This is assuming you want bash to run the commands. If you want things a bit more self-contained then add this as the first line of the file: #!/bin/bash and make the file executable by "chmod'ing" the file: chmod --changes u+x -- your_file_with_commands Now you can do: =2E/your_file_with_commands And if the script's directory is in your PATH then you can just type: your_file_with_commands Bash contains the ability to use variables, to do conditional branching ('if / then / elif / else / fi' and '[ ] / test'), loops, regex, arrays, associative arrays (yes!) and so on. Bash has had features continually added to it which means some documentation on Bash programming doesn't use the new features and non-updated installs of Bash might not have certain features. Some exercises: 1. What happens if the script is executable but doesn't have a #! line at the top? 2. What could you have instead of /bin/bash in the #! line? M. --=20 FSF member #9429 http://www.fsf.org/register_form?referrer=3D9429 http://www.fsf.org/about "The Free Software Foundation (FSF) is a nonprofit with a worldwide mission to promote computer user freedom and to defend the rights of all free software users." --jTQnPZUAoBwnzLBojDKjR5I6xyvHs1xQz-- --fCqXmwr1fc6Ro3kYZ8vpR2eniKV9TL8IH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEymnV/lrtCqpNhpze13JsPqr44+8FAl1S8nUACgkQ13JsPqr4 4+/+UBAAvl5Rn915StiVKlrJCnSWJhrmv4K5ExNsrzkRdRiP2nGECw9Lo85H20rr E4bb4mn4r9mfp15mtDKrGCHWtoqD8cTmy+jMFMi9yGPWSqobHxSj1Fe6JSSj2M4F HTvXkyz4AuLMrHnyn7iA+cR1aHVZAwRRfEiDvjg1bCSBJYEmTtmR9dHm+Jx+FUYr iZnDutRuGCfmJeASCK3MGlG9pWbpGukaoJkyG8Ec+TmyZdqitdJTKD0gNMlW6YQM wz7x3nzlE/bSNnuxBCkOlW5WhYmTN6tXSHKRqaMx6nhYrdetooDdnTIILf4e4g7a kdBMVvVGF8Eph+5lVssh5vT9h292ifY2neoZvqiqhTqQ9LMY2VKWIn11To/e8SZj lfsudiNoZRH+oDOxw0J6Yjr/JOnWbcBvrXrTObCCFCQkjDeHzZgScOEhve+g2Nbg hxu9u+qJrEqYOSJWIWd/Z4+mufv5yT6/RtxBxV38T96yEhhhq+h/sbfbjA7zNfcH +w+zJis97I0t4Qt+DgOMMQdjhM50a4CTmJCgxLZP30vJuXgnI4lDZE9BWMArYf+3 9Cte/X68EJdQpyKeDuSDKZ9e4Qm7jDxcWnGietDbgtAyAhgt+TPs7/lXPzUCI0Jz azaosAMdEaGSCSBO20KRCm9ADxazjJ++Qq4DCrzXZ7lPvJsuqlE= =SMgf -----END PGP SIGNATURE----- --fCqXmwr1fc6Ro3kYZ8vpR2eniKV9TL8IH-- --===============0518341840516648458== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KRnN1ay1tYW5j aGVzdGVyIG1haWxpbmcgbGlzdApGc3VrLW1hbmNoZXN0ZXJAbm9uZ251Lm9yZwpodHRwczovL2xp c3RzLm5vbmdudS5vcmcvbWFpbG1hbi9saXN0aW5mby9mc3VrLW1hbmNoZXN0ZXIK --===============0518341840516648458==--