LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-16-2017, 11:24 AM   #1
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237
Blog Entries: 2

Rep: Reputation: Disabled
Question What is programming like?


Im just starting to get into shell scripting and it's fun, but I hear a lot of people say that shell scripting is not programming. So im wondering how different is programming compared to shell scripting? The main thing I want to know though is, is there a plethora of commands you have to memorize like in Linux? I accumulated (learned) I feel a nice set of Linux commands, but it took me awhile to do so and really understand them and their options. Will that process repeat for leaning something like Ruby/Python or Lua? Thanks in advance!
 
Old 05-16-2017, 11:29 AM   #2
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
Programming is structured syntax like scripting but the technically the difference is that a Programming language uses a compiler whereas a scripting language uses an interpreter. But as there are languages that can use both... it's kinda murky. Thus I'd say the difference is do you end out with a script (human-readable file that is interpreted when called) or a program (binary file that can be executed directly).

Generally speaking scripts are usually easier to write/maintain/use but as they are interpreted each time, are more CPU intensive and can give slightly less consistency (as an interpreter on one machine may not give the same results as the interpreter on another.). I'd switch to a program when getting over 1~2K lines of coding, personally.

Last edited by r3sistance; 05-16-2017 at 11:32 AM.
 
Old 05-16-2017, 11:35 AM   #3
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237

Original Poster
Blog Entries: 2

Rep: Reputation: Disabled
Quote:
Originally Posted by r3sistance View Post
Programming is structured syntax like scripting but the technically the difference is that a Programming language uses a compiler whereas a scripting language uses an interpreter. But as there are languages that can use both... it's kinda murky. Thus I'd say the difference is do you end out with a script (human-readable file that is interpreted when called) or a program (binary file that can be executed directly).

Generally speaking scripts are usually easier to write/maintain/use but as they are interpreted each time, are more CPU intensive and can give slightly less consistency (as an interpreter on one machine may not give the same results as the interpreter on another.). I'd switch to a program when getting over 1~2K lines of coding, personally.
Understood, the interpreter being the shell and the compiler being gcc (for C and C++).. But the main point I need to know is do programming languages have commands or just a very rich syntax? (if that makes sense?)

Last edited by justmy2cents; 05-16-2017 at 11:36 AM.
 
Old 05-16-2017, 12:07 PM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 16,604

Rep: Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604Reputation: 5604
programming means something like that:
you have a goal what you want to reach and you instruct your computer to do that.
There are difficult goals and simple goals. And also there are different languages to implement your wish(es) and logic.
 
Old 05-16-2017, 12:10 PM   #5
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,604

Rep: Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946
Quote:
Originally Posted by justmy2cents View Post
I hear a lot of people say that shell scripting is not programming.
The distinction between these is rather fuzzy. Programming in Ruby, Python, or Lua is often called scripting too. I would say scripting is programming.

Quote:
So im wondering how different is programming compared to shell scripting? The main thing I want to know though is, is there a plethora of commands you have to memorize like in Linux? I accumulated (learned) I feel a nice set of Linux commands, but it took me awhile to do so and really understand them and their options. Will that process repeat for leaning something like Ruby/Python or Lua? Thanks in advance!
Languages usually come with "standard libraries", a set of functions. The standard libraries of Lua or C are small enough to feasibly learn entirely, but for Ruby and Python they're generally too big to memorize. You just look things up as needed.
 
1 members found this post helpful.
Old 05-16-2017, 12:23 PM   #6
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,229
Blog Entries: 4

Rep: Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260Reputation: 3260
Actually, I would make a different distinction with regards to Bash shell scripting, and it has to do with the sophistication of the language being used. Bash's scripting engine really wasn't designed to be used for all of the purposes that it is used for. Other programming languages are designed for serious work – whether they are interpreted or compiled.

You can add a one-line "shebang" line as the first line of your script ... say #!/usr/bin/env php, and write the rest of your script in PHP. You can do the selfsame thing for many different scripting languages and do the same thing. Bash will load the specified command-interpreter to run your script. The end-user will never know.

Personally, I cringe when I have to dissect "a wad of bash-scripting" and sometimes I have found it more expedient just to replace the damned thing using a far more powerful language.
 
Old 05-16-2017, 12:38 PM   #7
dave@burn-it.co.uk
Member
 
Registered: Sep 2011
Distribution: Puppy
Posts: 601

Rep: Reputation: 172Reputation: 172
As implied, it very much depends on what level of code you are going to be using.
High level languages tend to be relatively easy to learn because they are closer to everyday language.
Low level languages like Assembler and perhaps C are vastly different and take a very special mind set to use correctly and efficiently.

High level is:
Type a "x"!

Low level is:
Think about typing an X
turn your eyes to look at the keyboard. Scan it for the leter that looks like X
fix its locaction in your brain.
work out what movement is needed to put a finger on it
decide which finger to use
.
.

..

and so on. And even that is high level coding.
 
Old 05-16-2017, 12:40 PM   #8
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237

Original Poster
Blog Entries: 2

Rep: Reputation: Disabled
Quote:
Originally Posted by ntubski View Post
The distinction between these is rather fuzzy. Programming in Ruby, Python, or Lua is often called scripting too. I would say scripting is programming.



Languages usually come with "standard libraries", a set of functions. The standard libraries of Lua or C are small enough to feasibly learn entirely, but for Ruby and Python they're generally too big to memorize. You just look things up as needed.
Thanks for the clarification.. So I just need to memorize the libraries and functions for the relatively simple languages like Lua.. And I take it the reason why Ruby has so many frameworks is because it's big, so that makes sense.. Thanks!
 
Old 05-16-2017, 12:44 PM   #9
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237

Original Poster
Blog Entries: 2

Rep: Reputation: Disabled
Quote:
Originally Posted by sundialsvcs View Post
Actually, I would make a different distinction with regards to Bash shell scripting, and it has to do with the sophistication of the language being used. Bash's scripting engine really wasn't designed to be used for all of the purposes that it is used for. Other programming languages are designed for serious work whether they are interpreted or compiled.

You can add a one-line "shebang" line as the first line of your script ... say #!/usr/bin/env php, and write the rest of your script in PHP. You can do the selfsame thing for many different scripting languages and do the same thing. Bash will load the specified command-interpreter to run your script. The end-user will never know.

Personally, I cringe when I have to dissect "a wad of bash-scripting" and sometimes I have found it more expedient just to replace the damned thing using a far more powerful language.
That's cool and yeah I hear that a lot as well, that once you know Python then there's no reason to shell script. I just want to learn still for the admin type job roles, and to understand what the pre-built shells scripts on my system are doing..
 
Old 05-16-2017, 12:48 PM   #10
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237

Original Poster
Blog Entries: 2

Rep: Reputation: Disabled
Thumbs up

Quote:
Originally Posted by dave@burn-it.co.uk View Post
As implied, it very much depends on what level of code you are going to be using.
High level languages tend to be relatively easy to learn because they are closer to everyday language.
Low level languages like Assembler and perhaps C are vastly different and take a very special mind set to use correctly and efficiently.

High level is:
Type a "x"!

Low level is:
Think about typing an X
turn your eyes to look at the keyboard. Scan it for the leter that looks like X
fix its locaction in your brain.
work out what movement is needed to put a finger on it
decide which finger to use
.
.

..

and so on. And even that is high level coding.
Haha thats interesting, I never put 2+2 together to understand why people say C or C++ is hard to learn, but now I get it

Last edited by justmy2cents; 05-17-2017 at 11:23 AM.
 
Old 05-16-2017, 12:54 PM   #11
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Rep: Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148
Quote:
Originally Posted by justmy2cents View Post
Im just starting to get into shell scripting and it's fun, but I hear a lot of people say that shell scripting is not programming. So im wondering how different is programming compared to shell scripting? The main thing I want to know though is, is there a plethora of commands you have to memorize like in Linux? I accumulated (learned) I feel a nice set of Linux commands, but it took me awhile to do so and really understand them and their options. Will that process repeat for leaning something like Ruby/Python or Lua? Thanks in advance!
BASH Scripting is scripting
Java Scripting is scripting
they are not programming languages. They are scripting languages.

But they will carry over into a programming language or visa versa. The logic that is. Because everyone has conditionals, loops, boolean logic operators (for the most part) bit shifting etc...

it is like learning any language. You will just need to learn how to speak it for that programming language you want to learn. Then when you go to another one the meaning is the same just said differently.

Code:
if [ condiston = true ] 
then
 do something 
fi


if ( true ) 
do something

if ( true ) {
do something
}

do{
}while ( true ) 

while (true) do
so forth and so on. The logic is the same, and it all acts on truth.

Last edited by BW-userx; 05-16-2017 at 12:58 PM.
 
Old 05-16-2017, 01:06 PM   #12
uber_nerd
LQ Newbie
 
Registered: May 2017
Location: Arizona
Distribution: Slackware, Arch
Posts: 3
Blog Entries: 1

Rep: Reputation: Disabled
what is programming like?

That is a good question. I liken shell scripts to the OLDE days of writing .bat or .sys files in Windows OS (think 3.1 and '95). To me, a script is a single line (or several lines) that performs a function and does not require any compiling. Programming, on the other hand, involves running the source code through a compiler and linker to get a binary output called an executable. The 'executable' is a stand alone (doesn't need any extra items to run - you simply call its name and the program runs).

Back in the day, when BASIC was the 'go to' (no pun intended - sorry..) for programming, it was simply run via an interpreter (no compiling needed). The machine parsed each section of code for accuracy and correctness. To me - scripts are kind of like that.

Hope I didn't muddy the waters too much.

UN
 
Old 05-16-2017, 01:15 PM   #13
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237

Original Poster
Blog Entries: 2

Rep: Reputation: Disabled
Quote:
Originally Posted by BW-userx View Post
BASH Scripting is scripting
Java Scripting is scripting
they are not programming languages. They are scripting languages.

But they will carry over into a programming language or visa versa. The logic that is. Because everyone has conditionals, loops, boolean logic operators (for the most part) bit shifting etc...

it is like learning any language. You will just need to learn how to speak it for that programming language you want to learn. Then when you go to another one the meaning is the same just said differently.
They all share the same core concept which is relief, I was just nervous on how many "commands" they may have and how many I'm expected to know, in order to "know that language". I remember Larry Wall (the author of Perl) said that a programmer should know at least 5 languages, and I was wondering how achievable is that.. Then again I remember someone saying that learning a programming language is just like learning any natural language..

Last edited by justmy2cents; 05-16-2017 at 01:19 PM.
 
Old 05-16-2017, 01:18 PM   #14
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Rep: Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148
Quote:
Originally Posted by justmy2cents View Post
They all share the same core concept which is relief, I was just nervous on how many "commands" they may have and how many I'm expected to know, in order to know that language. I remember Larry Wall (the author of Perl) said that a programmer should know at least 5 languages, and I was wondering how achievable is that.. Then again I remember someone said learning a programming language is just like learning any natural language..
that is his option, and what do they say about options?

learn one really well, then you can move to a different one. But that is just (my) an option.

as far as remembering all of the function calls you will be using - you will learn them as you learn - some you will remember some you may not remember, but that is what the api docs and books are for.

Last edited by BW-userx; 05-16-2017 at 01:19 PM.
 
Old 05-16-2017, 01:27 PM   #15
dave@burn-it.co.uk
Member
 
Registered: Sep 2011
Distribution: Puppy
Posts: 601

Rep: Reputation: 172Reputation: 172
Quote:
so forth and so on
Pun intended??

Well yes you did a little, but that is only because BASIC is a poor example because it is both interpretative AND often compiled - but that is probably true of most interpreted programming languages.

I suspect a (only slightly) better way of distinguishing them is that a script is often written by the user for his specific requirements whereas a program is pre-written and is more generic. I would also say that scripts are written to control programs.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: New to Programming? Check out these Outstanding Open Source Programming Books LXer Syndicated Linux News 0 01-25-2017 09:33 AM
future of programming, programming jobs, programming languages? detr Programming 17 08-01-2016 03:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration