scripts

douwe

New Member
Joined
Jun 12, 2022
Messages
5
Reaction score
1
Credits
41
Hi everyone, I've been exploring Linux for a few weeks now. I have also watched a lot of Joe Collins movies on youtube. The films about scripting in particular gave me the idea that computer programs might be written in this way. Is that right?
 


Welcome to the forum!

I think that depends on your definition of "program". Scripts are typically linear, and are designed to do a task, then end. Applications typically run until they are closed by the user, like web browsers and word processors. Then you have daemons and services, which are programs that run in background, doing things like logging, or running web servers.
 
Thanks for your reply. I understand, and it is not my intention at all to make computer programs. I'm just curious. Are programs always written in plain text or are they applied in other ways?
 
Thanks for your reply. I understand, and it is not my intention at all to make computer programs. I'm just curious. Are programs always written in plain text or are they applied in other ways?
There are lots of programming languages, and they vary in complexity, purpose, and human-readability. Very low-level languages like ASM (assembly), are basically used to directly interact and manipulate the computer hardware, by setting bits and registers, and are about as far as you can get from readability as you can get. Higher level languages are varying degrees of "plain text" and human-language-like syntax. As well, different languages might be general-purpose, and other might be very purpose-specific. So, when choosing a language, it's important to know what your goals are.
 
The problem is loose definitions. When people say scripting, they tend to mean non-compiled languages, such as PHP, Python, Bash, Java, Perl, etc... When people say programming, they tend to refer to compiled languages like C, C++, or even COBOL (among others).

You can do a lot with all the languages, though some excel in different areas.
 
Thanks for your reply. I understand, and it is not my intention at all to make computer programs. I'm just curious. Are programs always written in plain text or are they applied in other ways?
Pretty abstract question, but pretty easy answer: Yes, with one exception.

Expanding: Everything you do is presented in plaintext (barring the exception). However, it diverges after that:
You get interpreters, which run the text interactively, converting code in plain text to system calls on-the-fly (to add: the interpreter is a program in of itself), and you get compilers, which convert the text to native machine code that is subsequently executed (run). Then there's a grey area in the middle. Things like JIT (Just In Time) compilers that compile code "as" it's executed ("as" is not fully correct, it has to read a certain amount ahead, obviously, but let's keep it simple). There's lots more grey: translation layers, binary to binary compilers (yes, they exist), and over 50 Shades More.
But to keep things simple: You read and write code in "plain text" (alpha-numeric characters with symbols included) and from there, it can become any number of things. There are many languages out there and some are tailored for special purposes, others general. Purpose brings us to paradigm, but I won't get into that sufficed to say "the way that language is used" (some languages work in multiple paradigms).

So what was the exception? "Visual programming" (nothing to do with Visual Basic language or VSCode IDE, lol). This is a drag 'n drop -style system of logic. I dismissed it at first, then my bestie compared it to logic gates and designing ICs, which shut me up in my arrogant dismissal rant -- I am infamous on and offline for ranting, mostly as a prelude to making an idiot of myself).
I don't think any of us take this visual approach seriously (I never will, even after being slapped down). TBH, I'm anti this for no logical reason, I'm just a traditionalist... and I don't get it... and it feels like cheating...
Objectively, this is just another interface. All methods of programming are simply a means of interfacing with a computer and they all amount to a simple thing: logic flow. Everything is just that, a flow of logic. Even our spoken languages. In fact programming existed before computers. In an abstract by Ada Loveless, in mathematics, and even in our own biology... and psychology. Everything is a set of logical instructions and how we interact with them is a mere interface (oh dear, time for the "causality" debate).

If you got this far, cool. Here's all you need to really sleep easier, though: Traditionally, you write all your "code" in a file which is essentially plain old text. They may look otherwise, but it is just text (ignoring the visual outlier). Now can you learn to program? Yes, anyone can code, but not necessarily well. How you do it and in what language depend on a compromise between what you're most comfortable with and what is most pragmatic.

That's the most honest answer I can offer to that question.
 
Last edited:
Thanks for your answers. Just to be clear. My intention is to learn Linux. I don't need to program. I have already followed several tutorials on youtube but what is the best learning order now.
 
You might try some of the free courses on edx, such as:

No need to mess with learning any programming language unless you feel the need.
That said knowing the basics of Bash scripting can be quite helpful.
 
Thanks for your reply. I understand, and it is not my intention at all to make computer programs. I'm just curious. Are programs always written in plain text or are they applied in other ways?
i once typed code directly onto "punched cards" for running Fortran IV circa 1975 Computer Science was a module for an O.N.D i was doing

You don't need to program to play or use Linux productively, but learning a few commands , that you use at a terminal would be useful for long term use. You can use these commands interactively . When several commands are put together and written to a file; you can run those commands from the file, they are run in sequence and you could call that a program.
I'm sure @KGIII must have something on his web site https://linux-tips.us/indexes/index/ as an intro


when i forget who i am , and don't trust the prompt ,i use this one :
Code:
 [andrew@darkstar:~]$ whoami                                               (07-08 21:01)
andrew
[andrew@darkstar:~]$                                                      (07-08 21:01)
 
Last edited:
Thanks for your answers. Just to be clear. My intention is to learn Linux. I don't need to program. I have already followed several tutorials on youtube but what is the best learning order now.
You will need to learn a tiny bit of bash, most importantly the "sudo" command for updates and installation. Even though bash is a scripted programming language, you will only need to learn commands, which isn't technically programming.

Once you have a Linux distribution installed, you will probably find using it with clicking (through the Graphical User Interface, GUI for short) really easy, or at least easy, they're not so different from everything else.

Lots of programs are installed through clicking on an install file like with Mac and Windows or through the software center (an app inside of many distros with similar names...). Knowing how to install through the command line is all you need to know with bash, no programming necessary.
 
Joe Collins has some really good videos, especially regarding the bash terminal, so I think you did well choosing.

Adding to what others have said, while you're new, think of the terminal, and bash, as similar to cmd (command line) in Windows. I recommend the following freely downloadable book The Linux Command Line, which does a good job explaining how to get around. https://www.linuxcommand.org/tlcl.php

Good luck on your Linux journey!
 
You will need to learn a tiny bit of bash, most importantly the "sudo" command for updates and installation. Even though bash is a scripted programming language, you will only need to learn commands, which isn't technically programming.

Once you have a Linux distribution installed, you will probably find using it with clicking (through the Graphical User Interface, GUI for short) really easy, or at least easy, they're not so different from everything else.

Lots of programs are installed through clicking on an install file like with Mac and Windows or through the software center (an app inside of many distros with similar names...). Knowing how to install through the command line is all you need to know with bash, no programming necessary.
Thank you for your message, but this is not the intention. My intention is to do as much as possible via the command line. The more so because I also have a Raspberry 3 in my network. I can approach this with putty and then of course I don't have a graphical environment.
 
Joe Collins has some really good videos, especially regarding the bash terminal, so I think you did well choosing.

Adding to what others have said, while you're new, think of the terminal, and bash, as similar to cmd (command line) in Windows. I recommend the following freely downloadable book The Linux Command Line, which does a good job explaining how to get around. https://www.linuxcommand.org/tlcl.php

Good luck on your Linux journey!
Many thanks for the link to the book. I have placed it as a pdf file on my server. I spend a few hours every day learning Linux. As for Joe Collins: I learned a lot from that. His pronunciation of English is easy for me to follow. You should know that my native language is Dutch and I have not had any English lessons. The messages I post here are created using Google translate. Reading the messages generally goes well without help.
 
The films about scripting in particular gave me the idea that computer programs might be written in this way. Is that right?
Let's start with what a script is:
From here https://techterms.com/definition/script
Script files are usually just text documents that contain instructions written in a certain scripting language. This means most scripts can be opened and edited using a basic text editor. However, when opened by the appropriate scripting engine, the commands within the script are executed. VB (Visual Basic) scripts, for example, will run when double-clicked, using Windows' built-in VB scripting support.
What is a computer program?
From here https://en.wikipedia.org/wiki/Computer_program
A computer program is a sequence or set of instructions in a programming language for a computer to execute. Computer programs are one component of software, which also includes documentation and other intangible components.
A computer program in its human-readable form is called source code. Source code needs another computer program to execute because computers can only execute their native machine instructions. Therefore, source code may be translated to machine instructions using the language's compiler. (Machine language programs are translated using an assembler.) The resulting file is called an executable. Alternatively, source code may execute within the language's interpreter.
As you can see, they have some similarities; they're both files and run a set of instructions. So, yes, computer programs "can be written this way", but the way they're executed is different - and that explanation is beyond my pay grade, however, I do know (or think I do) a script doesn't directly interact with hardware, whereas computer programs might, i.e, graphics drivers. On Linux, you can write and execute your own scripts by using the scripting languages available by default; bash, python, awk, etc. You just need to launch a text editor, type in your code, save it with a name and the appropriate extension, for example, bash scripts have the .sh at the end of its name, i.e my_script.sh, you make this file executable, that is you tell the OS to read and run the instructions within the file, and voilà! Learning to create a few basic scripts to do one - or more - task(s) is quite handy, since you won't need to install a whole app to do it, saving some system's resources. I'm not expert by any means, by I do have a few ones to do some things; backup my dot_files to a USB drive, launch a web browser and open a URL for some webinar that is set to start at some time, check newer releases for some appimages I use ... as the old saying goes, "the sky is the limit", well, maybe not the sky, but you get the idea lol
I think the best example of a script you're probably running every day, is the ~/.bashrc file. It's a file hidden in your home directory, you can see it by launching your OS' file manager and pressing Ctrl + h keys. This file is just a shell script that is executed automatically when a user creates a new shell - like when you launch a terminal - that is a non-interactive login shell, and takes care of setting some variables and other things within that shell session. For more info read here https://tldp.org/LDP/abs/html/sample-bashrc.html
And the best example for a computer program is the OS itself, since it is just another software you install on your computer. I think you can think of scripts as "small, very basic set of instructions that perform certain tasks", and computer programs as "big, more sophisticated and complex set of instructions that can perform certain tasks".
This might be a good read: https://www.softwaretestinghelp.com/scripting-vs-programming/
 
Let's start with what a script is:
From here https://techterms.com/definition/script

What is a computer program?
From here https://en.wikipedia.org/wiki/Computer_program

As you can see, they have some similarities; they're both files and run a set of instructions. So, yes, computer programs "can be written this way", but the way they're executed is different - and that explanation is beyond my pay grade, however, I do know (or think I do) a script doesn't directly interact with hardware, whereas computer programs might, i.e, graphics drivers. On Linux, you can write and execute your own scripts by using the scripting languages available by default; bash, python, awk, etc. You just need to launch a text editor, type in your code, save it with a name and the appropriate extension, for example, bash scripts have the .sh at the end of its name, i.e my_script.sh, you make this file executable, that is you tell the OS to read and run the instructions within the file, and voilà! Learning to create a few basic scripts to do one - or more - task(s) is quite handy, since you won't need to install a whole app to do it, saving some system's resources. I'm not expert by any means, by I do have a few ones to do some things; backup my dot_files to a USB drive, launch a web browser and open a URL for some webinar that is set to start at some time, check newer releases for some appimages I use ... as the old saying goes, "the sky is the limit", well, maybe not the sky, but you get the idea lol
I think the best example of a script you're probably running every day, is the ~/.bashrc file. It's a file hidden in your home directory, you can see it by launching your OS' file manager and pressing Ctrl + h keys. This file is just a shell script that is executed automatically when a user creates a new shell - like when you launch a terminal - that is a non-interactive login shell, and takes care of setting some variables and other things within that shell session. For more info read here https://tldp.org/LDP/abs/html/sample-bashrc.html
And the best example for a computer program is the OS itself, since it is just another software you install on your computer. I think you can think of scripts as "small, very basic set of instructions that perform certain tasks", and computer programs as "big, more sophisticated and complex set of instructions that can perform certain tasks".
This might be a good read: https://www.softwaretestinghelp.com/scripting-vs-programming/
Scripting languages are programming languages...but programming languages are not necessarily scripting languages. All scripting languages are read by an interpreter. For example, the aliases I made:
Code:
alias ls='ls --color=auto -hAF'

alias lsh='ls -d .* | grep -v /'

alias lsf='ls | grep -v /'

alias lsd='ls -d */ .*/'

alias lsdh='ls -d .* | grep -v *.txt'

When that code is put into a ~/.bash_aliases file, it causes the shell to interpret your commands differently than the default way it would. The shell has been programmed because the shell is instructed to read .bash_aliases if it exists.

Saying that scripting languages and programming languages are two distinct separate things seems confusing, what they mean by "programming languages" in that article are machine languages, those languages which require compilers instead of interpreters. I also don't really like how people now adays are saying that HTML is not a programming language. Of course it is: you use the HTML to program a browser.

"Programming" could also theoretically be used to describe an even larger set of behaviors...like, if you change a keybinding, or change a setting, or save a file (programming a hard drive...), or install an operating system. However, these last ones are not the way that people normally mean it, in the sense of "being a programmer", this just refers to using programming languages in a text file or altering hexadecimal/binary numbers manually...
 
When that code is put into a ~/.bash_aliases file, it causes the shell to interpret your commands differently than the default way it would. The shell has been programmed because the shell is instructed to read .bash_aliases if it exists.
You can put all your aliases in the .bashrc file, too, no need for a .bash_aliases file, tho I find it better to use the latter, but it's really no necessary. Some distros don't have the
Code:
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi
in their .bashrc file, thus you need to add those lines to it, otherwise you'll have to source the .bash_aliases file every time.
Scripting languages are programming languages
Hmmm ... not sure on this one, but then I'm not an expert, so you're probably right. I wonder if @JasKinasis could offer some clarifying.
 
Last edited:
Hmmm ... not sure on this one, but then I'm not an expert, so you're probably right. I wonder if @JasKinasis could offer some clarifying.

I would that if you're writing an alternate language in a text file for a computer to read (they're worthless as spoken languages...), then that would make it a programming language, but i understand the insistence on isolating the compiler languages as "the real programming languages", since computers read binary...however, if the computer has software which is capable of reading human languages and programming languages (almost all do now adays), then i would think the distinction wouldn't be helpful to those who want to learn.
 
i would think the distinction wouldn't be helpful to those who want to learn.
Actually, I did some reading, and it'd seem all scripting languages are indeed "programming languages", but not all programming languages are scripting languages. I think the problem might be defining "programming". For example, here https://www.freecodecamp.org/news/what-is-programming/ it says:
Programming is the process of giving machines a set of instructions that describe how a program should be carried out.
Here https://www.codingem.com/what-is-programming/ they say:
Programming means writing instructions for a computer to perform desired actions.
And here https://www.codecademy.com/article/what-is-programming
Programming is the mental process of thinking up instructions to give to a machine (like a computer).
But here https://en.wikipedia.org/wiki/Computer_programming
Computer programming is the process of performing a particular computation (or more generally, accomplishing a specific computing result), usually by designing and building an executable computer program. Programming involves tasks such as analysis, generating algorithms, profiling algorithms' accuracy and resource consumption, and the implementation of algorithms (usually in a chosen programming language, commonly referred to as coding). The source code of a program is written in one or more languages that are intelligible to programmers, rather than machine code, which is directly executed by the central processing unit. The purpose of programming is to find a sequence of instructions that will automate the performance of a task (which can be as complex as an operating system) on a computer, often for solving a given problem. Proficient programming thus usually requires expertise in several different subjects, including knowledge of the application domain, specialized algorithms, and formal logic.
Do note that the one from Wikipedia refers to source code and all that stuff, while the others seem to only talk about the "creative process" involve in programming. I also read another post where they say "all scripting languages are programming languages, but not all programming languages are scripting languages". I have to admit that this is way over my head; I'm no programmer, coder, hacker, nothing, nada ... I'm an ESL teacher who uses Linux. I also like linguistics, so if you want to debate on any of those topics, I'm all ears (or rather eyes and fingers lol) :)
 
Actually, I did some reading, and it'd seem all scripting languages are indeed "programming languages", but not all programming languages are scripting languages. I think the problem might be defining "programming". For example, here https://www.freecodecamp.org/news/what-is-programming/ it says:

Here https://www.codingem.com/what-is-programming/ they say:

And here https://www.codecademy.com/article/what-is-programming

But here https://en.wikipedia.org/wiki/Computer_programming

Do note that the one from Wikipedia refers to source code and all that stuff, while the others seem to only talk about the "creative process" involve in programming. I also read another post where they say "all scripting languages are programming languages, but not all programming languages are scripting languages". I have to admit that this is way over my head; I'm no programmer, coder, hacker, nothing, nada ... I'm an ESL teacher who uses Linux. I also like linguistics, so if you want to debate on any of those topics, I'm all ears (or rather eyes and fingers lol) :)
Lmfao at the claim that thinking about programming is programming...a few years ago, when having some disgruntled thoughts about computers, i fantasized about making some super-virus. My fantasies never came to fruition, lol.

ESL, as "english as a second language"?
 

Staff online

Members online


Top