How do I learn programming, particularly bash shell scripting and SQL?

  • Thread starter shivajikobardan
  • Start date
  • Tags
    Programming
In summary, the problem is that the person does not know how to problem solve. He or she tries their best but fails. The person wants to learn programming but does not know how to start. Ways to learn problem solving are recommended.
  • #1
shivajikobardan
674
54
TL;DR Summary
How to learn programming?
For eg: Currently I am trying to learn bash shell scripting, text processing using bash etc. But the problem is I don't think I can learn it. Why? Because I don't know programming. In particular, problem solving. I don't know problem solving at all. I try my best but I fail. In the past, I tried learning MERN web development for around 1 year but failed to do so.
So, I am wondering how do I learn programming? Particularly, bash shell scripting. I don't need roadmap but way to learn problem solving.
 
Technology news on Phys.org
  • #2
shivajikobardan said:
I don't think I can learn it. I try my best but I fail.
First and foremost, stop saying things like this. Negative statements about yourself only reinforce negative feelings and thoughts about yourself and they don't make anyone want to help you. The second statement specifically is an 'all-or-nothing' statement that you don't need to be saying. There is rarely absolute, unredeemable, no silver lining, learned nothing, made no progress, devastating failure. If you haven't met your goals and expectations, then so be it. Do what you can to learn from failure and to find out why you had such difficulty and how to make better progress next time.

shivajikobardan said:
Why? Because I don't know programming. In particular, problem solving. I don't know problem solving at all. I try my best but I fail.
There is no hard dividing line between knowing and not knowing programming. Just like nearly every skill it's a continuum of knowledge and experience. If you've spent time and effort learning programming then you're going to have some level of skill in it.

shivajikobardan said:
So, I am wondering how do I learn programming? Particularly, bash shell scripting. I don't need roadmap but way to learn problem solving.
I suspect you already know how to problem solve. Almost everyone does. I'm betting you're getting hung up on something that is preventing you from utilizing your problem solving skills. For me, I am easily overwhelmed by complexity and when I have to learn a bunch of things all at once for a project that I don't already know how to do. I have to focus on the next step or two and push the later steps aside.

When faced with a problem, what are the difficulties you encounter when you try to solve it? What prevents you from making progress?
 
  • Like
Likes Ishika_96_sparkles, DaveE and berkeman
  • #3
Enjoy doing something artistic, and easily attained in the language.

Then you will realise that anything is possible, once you break it into smaller parts.

Build on your success.
 
  • #4
Three key items I've found to make things easier are Curiousity, a like of Solving Problems, and decent Learning Materials that present concepts in both overview and detail. The Learning Materials will ideally show how various ideas/concepts fit together and depend on each other.

Some concepts are difficult or may be presented in a way that does not match your way of thinking. If this is a major stumbling block for you, get different Learning Materials and try again.

Having a local Mentor, or even a friend that has dabbled in the subject, whom you can ask questions of and get guidance from, makes learning a LOT easier.

Also @Drakkith brought up a good point:
Drakkith said:
I am easily overwhelmed by complexity and when I have to learn a bunch of things all at once for a project that I don't already know how to do. I have to focus on the next step or two and push the later steps aside.
Sometimes you may need a variation on that thought. You may find parts of a problem that have you completely at a loss.

Often it's OK to skip ahead to the next step and come back to that problem area later; that next step may point out what is needed in the skipped step. (and your sub-conscious mind may be working on the problem too!)

Cheers,
Tom

p.s. or perhaps your basic personality is one that leans more to the arts, language, sociology, or ???. if that's the case, there's no foul there, we all have our different weak and strong areas.
 
  • #5
Tom.G said:
a like of Solving Problems
I don't like solving problems. But I like having solved a problem. :wink:
 
  • Haha
Likes Tom.G
  • #6
Why did you think you'd learn C# in two weeks? If these kinds of time frames are what you expect, that's completely unrealistic.
 
  • Informative
Likes symbolipoint
  • #7
I would say you need to increase your attention span - "I want to learn SQL!"..."I want to learn game development!"..."I want to learn data structures!!": Every few days you change directions, so of course you aren't making a lot of progress.

I would also say that you treat people who try and help you very badly (as an example, see the snake thread). Keep that up and nobody will want to help you any more. That will certainly get in the way of your learning.
 
  • Like
Likes Ishika_96_sparkles
  • #8
shivajikobardan said:
TL;DR Summary: How to learn programming?

For eg: Currently I am trying to learn bash shell scripting, text processing using bash etc. But the problem is I don't think I can learn it. Why? Because I don't know programming. In particular, problem solving. I don't know problem solving at all. I try my best but I fail. In the past, I tried learning MERN web development for around 1 year but failed to do so.
So, I am wondering how do I learn programming? Particularly, bash shell scripting. I don't need roadmap but way to learn problem solving.
One tiny step at a time... Are you passed the the "Hello World" stage?

If so, keep going. Try out one tiny thing at a time and don't give up until you not only get that small thing to work, but you know why it works and have demonstrated at least a few working examples.
Only then move onto the next tiny thing.

You may not thing that that this is building anything great, but it is. You will be programming yourself. You'll be building up a library of tiny things and when it comes to tackling something interesting, either that library will be have everything you need or it'll be back to the tiny exercises.

As far as "problem solving" skill is concerned, as soon as I started working with other programmers (decades ago) I was immediately struck by the diverse ways that people have of attacking a problem. It's almost like a finger print. Some sort of analytic skill is required, but I think these are the important factors:
1) You like coding. There's so much detail involved, that if you don't like the activity, it will be torture.
2) You are willing and able to follow that library-building process I described. All coders do it all the time. The bigger your library, the more you will be able to identify projects you can tackle. Short of retirement or the grave, you will never finish your library.
3) Especially early on, code with others. If you try to code solo without ever sharing your experience and without ever hearing comments about your project from others, you will stop. It's not just picking up tricks. At least to a small extent, the activity needs to be a social thing - otherwise, you will stop.
4) Use online coding examples and other resources.
 
  • Like
Likes Vanadium 50
  • #9
shivajikobardan said:
TL;DR Summary: How to learn programming?

For eg: Currently I am trying to learn bash shell scripting, text processing using bash etc. But the problem is I don't think I can learn it. Why? Because I don't know programming. In particular, problem solving. I don't know problem solving at all. I try my best but I fail. In the past, I tried learning MERN web development for around 1 year but failed to do so.
So, I am wondering how do I learn programming? Particularly, bash shell scripting. I don't need roadmap but way to learn problem solving.
What is this, "bash"? Is it a programming language? Did you learn the prerequisite courses which lead to bash? (Right, I should do a web search and find what is bash.) Maybe you are weak in your prerequisites and need to review.
 
  • #11
berkeman said:
It's a scripting language used with Unix/Linux (and maybe other places, I've only used it with Linux):

https://en.wikipedia.org/wiki/Bash_(Unix_shell)
I read that just after I asked. Thanks. I have nothing to advise. PROGRAMMING is problem solving. My possibly obsolete guess is that a person should choose something as a beginning programming course taught at a university or college, and go on from that. One learns to problem-solve in such courses and one also needs to learn to solve problems in every and all mathematics and many science courses. Something such as "bash" is beyond me. Maybe @shivajikobardan could share what his experiences and academic progression have been.

note: hey mentors and moderators don't get twisted with that capitalization up there. I sometimes use word in all capitals for emphasis; not for shouting.
 
  • #12
I wanted to "like" pretty much all the anwsers to the OP's question.

But defintely yes: don't belittle yourself.

Learning programming is like learning a ton of similar things. You can't learn programming, math or guitar by reading books. It's a lot like ice-skating. Even though many of the subjects don't look like they need to be committed to "muscle-memory" you can only learn them by doing.

What I'm trying to say is that you need to strap on the ice-skates and get a lot of bruises. Goes for any subject worth learning I think. That's why it takes a lot of time, concentration and commitment.
 
Last edited:
  • Like
Likes symbolipoint, Tom.G and berkeman
  • #13
symbolipoint said:
note: hey mentors and moderators don't get twisted with that capitalization up there.
Ahem, we do prefer that the terms Mentors and Moderators are capitalized... :wink:
 
  • Haha
  • Sad
Likes Tom.G and Vanadium 50
  • #14
symbolipoint said:
PROGRAMMING is problem solving.
Indeed. My limited experience has been that programming is a series of small problems embedded in ever larger problems that must be tackled and solved. Often you can solve a small problem, only to find out that it doesn't help you with your larger problem and you have to reevaluate and change things.
berkeman said:
Ahem, we do prefer that the terms Mentors and Moderators are capitalized... :wink:
Your name isn't even capitalized!
 
  • Haha
Likes PeterDonis
  • #15
berkeman said:
Ahem, we do prefer that the terms Mentors and Moderators are capitalized... :wink:
I will try to remember; I wouldn't want to confuse the readers by capitalizing the whole word; but I might cap the whole word, if I want emphasis or accentuation.
 
  • #16
Drakkith said:
Indeed. My limited experience has been that programming is a series of small problems embedded in ever larger problems that must be tackled and solved. Often you can solve a small problem, only to find out that it doesn't help you with your larger problem and you have to reevaluate and change things.

Your name isn't even capitalized!
(My own quoted parts did not get included in the above.)

As you confirm and say, programming often means breaking problems into smaller parts. Further, if the problem itself to solve through programming seems too big, the problem can be arranged into an outline; and then the smaller problems to be solved developed in each section of the outline. My own very limited best experience has/had been with a form of BASIC which works in Windows operating system.

About my member name, if I were to want my identifier member name to be all capitalized, that would mean creating a new forum account. Just no need for it.
 
  • #17
symbolipoint said:
About my member name, if I were to want my identifier member name to be all capitalized, that would mean creating a new forum account. Just no need for it.
I was poking fun at berkeman for making a joke about capitalization when his own name isn't even capitalized. :wink:
 
  • #18
shivajikobardan said:
So, I am wondering how do I learn programming?
I remember sending you a good problem set. I believe you have solved all of that, but still see no progress?
 
  • #20
haushofer said:
Yoda:
Silent he is. Ignoring us he seems to be.

Lack of follow-through this thread is example of. Much time spent answering people have spent.

Fun this is, talking like this!
 
  • Haha
Likes Tom.G
  • #21
Vanadium 50 said:
Silent he is. Ignoring us he seems to be.

Lack of follow-through this thread is example of. Much time spent answering people have spent.

Fun this is, talking like this!
Sarcasm it is not. Sincere you are very.

Succint verbose is for terse.

Suffer fools you do badly. :P
 
  • #22
And, to get this at least nominally back on track, Yoda speaks in Reverse Polish Notation. "Two and three add, you will."
 
  • #23
Vanadium 50 said:
Silent he is. Ignoring us he seems to be.

Lack of follow-through this thread is example of. Much time spent answering people have spent.

Fun this is, talking like this!
I am not ignoring anyone I am reading through all the comments.
 
  • #24
So let's step back a bit and look at one of your earlier attempts to learn programming.
You said you tried to learn MERN stack to build a website and failed.

So had you already successfully learned enough about each component - databases in general, and MongoDB in particular, Express.js programming, React, and Node.js, and done all this BEFORE starting your project? That's a large amount of stuff to be familiar with before starting on your project. How's your basic javascript skills? What about HTML and CSS skills?

Do you know if you installed and configured the MERN stack properly so that they can work together? I don't know how to do that yet I've done web work and programming work, so I'd need a lot of background work before even starting.

So to put it bluntly, you are taking on too much in one go! Unless you were an experienced programmer who is planning to switch to a new environment you are doomed to fail before starting.

So, learn to build a website using the standard html and css first.
Then try javascript programming,
Then if you are getting the hang of things, look at database basics and start simple - use perhaps mysql and php on a desktop server such as usb webserver or xampp or similar. (I used usb webserver when I am playing around.) Create a three to six table database, then the html forms and php code to insert data into these table, and to extract data and display it on a webpage. Although MongoDB works differently to standard sql databases, there are a huge number of online tutorials on sql and php (not all are good, but at least you can try something where almost any developer could help you.)

Now if you struggle at this stage, or haven't tried any of the above, you can totally forget trying your MERN project. Because there are lots of books and tutorials on doing the above, where you start with very simple examples, move on to bigger examples, then more complex things. Which you would need to know about before starting your project.

Perhaps you should take an online course that takes you through the basics of the above items. Some of the opening steps within each topic will seem very simple and you might skip them. But that means you don't have any experience of the basics which you will use repeatedly every day. You have to build up a set of examples that work so you can use the concepts they illustrate when creating a 20 step webpage that uses these basic steps all over the place.

You could try planning something a bit trickier before you start! Write simple steps involved in extracting data and presenting it on a webpage neatly formatted. So you might write down 20-30 lines of steps, each one representing a simple part of the entire process, then convert each line, one at a time, into code that works before starting on the next step. Eventually you have a working program. Learn to echo the result on screen so you can check if steps are working, then remove some of these once you are sure they are working and move on to the next step.
This is how you learn programming.

Now I've made around 45 - 50 websites, many using databases and PHP, but I wouldn't jump straight into starting a project using MERN as my first bit of work. Would you start learning to fly by getting into an jet fighter by yourself with no previous theory lessons or flights and trying to fly it to successfully fire a missile at a moving ground target as your first lesson???

I teach people to fly gliders / sailplanes. Teaching them to simply turn round and fly towards an object in the distance and do this properly can take many attempts! Even flying at a steady speed is tricky for most people. We teach flying in tiny steps that get repeated frequently with just a little bit more added in each lesson. Just like the online programming courses and books do.

SO as they say - learn to walk before you try to beat Usain Bolt in a 100m sprint, having bet your house that you will beat him.
 
Last edited:
  • #25
shivajikobardan said:
TL;DR Summary: How to learn programming?

For eg: Currently I am trying to learn bash shell scripting, text processing using bash etc. But the problem is I don't think I can learn it. Why? Because I don't know programming. In particular, problem solving. I don't know problem solving at all. I try my best but I fail. In the past, I tried learning MERN web development for around 1 year but failed to do so.
So, I am wondering how do I learn programming? Particularly, bash shell scripting. I don't need roadmap but way to learn problem solving.

For learning BASH in particular I'd familiarize myself with the BASH console. Start by feeling at home there. Learn to use apropos, man, little tricks like using pipe as in for instance: man find | less -p regex. Learn find, grep and fgrep,eg:

find ~/ -type f -name "*.sh" -exec fgrep whattofind {} \;

Then start automating your jobs with little BASH scripts. These will grow in complexity and et voila. All of a sudden you're scripting in BASH.

Just a suggestion.

I keep a ~/bin directory for all my little scripts. Add it to your PATH for convenience.

(DISCLAIMER: The commands were (not was, right?) from memory. I still often consult man and I consider myself a somewhat seasoned pro.)
 
  • #26
sbrothy said:
For learning BASH in particular I'd familiarize myself with the BASH console. Start by feeling at home there. Learn to use apropos, man, little tricks like using pipe as in for instance: man find | less -p regex. Learn find, grep and fgrep,eg:

find ~/ -type f -name "*.sh" -exec fgrep whattofind {} \;

Then start automating your jobs with little BASH scripts. These will grow in complexity and et voila. All of a sudden you're scripting in BASH.

Just a suggestion.

I keep a ~/bin directory for all my little scripts. Add it to your PATH for convenience.

(DISCLAIMER: The commands were (not was, right?) from memory. I still often consult man and I consider myself a somewhat seasoned pro.)

Incidentally, when things get too difficult in BASH try adding some Perl to your repertoire. "Robert's Perl Tutorial" is a very good starting point for learning Perl. Unfortunately I had to use the Wayback Machine to find it. It's:

www.sthomas.net/roberts-perl-tutorial.htm

Regards.

(I'd copy the URL but I'm on a public computer which for some reason doesn't allow copy paste (?))

An exercise for the reader :P

BTW, yes I know it's for ActiveState Perl for Windows but it still does the job.
 
  • #27
And btw all these wishes could be combined. Setting up Apache2 from the CLI requires a lot of fiddling with config files and whatnot. Setting up the entire LAMP configuration will also bring database and PHP into the picture. Especially if you do something like install phpBB. OK,*now* I'll stop.

I'll stop now. Happy coding.
 
  • #28
Wrichik Basu said:
I remember sending you a good problem set. I believe you have solved all of that, but still see no progress?
I've not started them yet. Now, I've a job that requires me to learn linux and sql, I don't think I'll get time for it. Even though I've holidays on saturdays and fridays, I've to learn linux and sql because that's what the job requires.
 
  • Like
Likes .Scott
  • #29
One of the biggest defects that I've is that I can't solve problems. Make a snake game? I've no idea how to proceed. Build a tic tac toe, I've no idea how to proceed. Build a arkanoid, I've no idea how to proceed. I read about them, I read the code, I still have no idea what is going on. I try to watch tutorial, I've no idea why are they doing it. I try to search stackoverflow, I don't understand why that solution works and how to develop that solution on your own. I don't know data structures and algorithms yet, so I wonder if that's what is hindering my coding development. Maybe practicing leetcode could help.
 
  • #30
haushofer said:
Yoda:
Program you cannot. Yet.
Reverse Polish Notation, abbreviated RPN is, Yoda has mastered.
RPN semantics, Forth coding language has, Yoda favors.
 
  • Like
Likes Vanadium 50
  • #31
shivajikobardan said:
One of the biggest defects that I've is that I can't solve problems. Make a snake game? I've no idea how to proceed. Build a tic tac toe, I've no idea how to proceed. Build a arkanoid, I've no idea how to proceed. I read about them, I read the code, I still have no idea what is going on. I try to watch tutorial, I've no idea why are they doing it. I try to search stackoverflow, I don't understand why that solution works and how to develop that solution on your own. I don't know data structures and algorithms yet, so I wonder if that's what is hindering my coding development. Maybe practicing leetcode could help.
There's no magic solution. The only way to learn is to do these things. If the tutorial doesn't make sense, do it again. Go through the example code line by line and figure out what every line is doing. Make sure you have a good reference for whatever language you're working in. I use C Sharp a lot so I make sure to have a 300-400 page book nearby that explains most of the language and has plenty of example code and mini-projects.
 
  • Like
Likes berkeman and Vanadium 50
  • #32
shivajikobardan said:
I don't think I'll get time for it.
Then what's the point of asking if you don't have time to do any of it?

Becoming good at programming - or anything, really - requires time and effort. If you don't put the time and effort in, you won't improve.
 
  • Like
Likes PeterDonis and berkeman
  • #33
shivajikobardan said:
One of the biggest defects that I've is that I can't solve problems. Make a snake game? I've no idea how to proceed. Build a tic tac toe, I've no idea how to proceed. Build a arkanoid, I've no idea how to proceed. I read about them, I read the code, I still have no idea what is going on. I try to watch tutorial, I've no idea why are they doing it. I try to search stackoverflow, I don't understand why that solution works and how to develop that solution on your own. I don't know data structures and algorithms yet, so I wonder if that's what is hindering my coding development. Maybe practicing leetcode could help.
shivajikobardan said:
I've not started them yet. Now, I've a job that requires me to learn linux and sql, I don't think I'll get time for it. Even though I've holidays on saturdays and fridays, I've to learn linux and sql because that's what the job requires.
Congratulations on the new job; please do your best.

We have been down this discussion path before with you, and we've done all that we can. This thread is closed.
 
  • Like
Likes Wrichik Basu
  • #34
Most programmers learn the basics of Linux ie the commands for the command line. Many are similar to Windows DOS commands and so the transition is made easier. From there they branch into using vi so you can edit files and then to the basics bash scripting with command line arguments echo statements…

Fancier bash stuff usually doesn’t come into play initially. When the fancier stuff is needed is when I switch to either AWK to get some value from some file or to a python implementation of the tricky part of even the whole script. BASH fancy coding can be very tricky and simple is better. BASH can become a write only script where you really have to understand it to figure out whats going on not so much with python.

Similarly for SQL, one learns how to write simple SELECT queries against an existing table in a database and then combining tables using a common key. The next level is using the grouping or sorting feature of the SELECT statement. The most advanced SQL that I've seen has been where you write SQL to write SQL that does the job you need. Sometimes this entails reading the metatables that control the overall database (tables that have schema names, table names, column names, types ... that could be used to manage or reorganize the database.

Chances are thought any job that requires knowledge of SQL is limited to more basic SQL knowledge like the SELECT, INSERT, UPDATE, and DELETE statements and depending on the database the UPSERT statement which is a combined INSERT if not present or UPDATE if present.

Database Admin

As you expand your knowledge of SQL to the DESCRIBE statement to get info on table columns and the EXPLAIN statement to understand how a complex SELECT statement did its job.

Further depth in SQL is learning how to optimize queries with index tables and other tricks like backing up databases and restoring them.

Database Designer

Database designers learn how to design a collection of tables ie a schema to hold your data in an optimal way With no duplicated data. The most common schema is the star schema where you have a central fact table with smaller dimension tables connected by common keys.

https://en.wikipedia.org/wiki/Star_schema

As a simple example, an inventory of your personal books. The fact table would have a row for each book with its title, field or DDS #, year of publication, author-id key, publisher-id key. Associated with the fact table would two dimension tables one for author info like author-id, author name, and other related author info like a bio And another similar table for publishers that include a publisher-id, and name. The id fields are what binds the dimension tables to the fact table and can be used in a SELECT statement to retrieve the author name for each book of interest.

Programmers can quickly learn SELECT statements and then learn the others as they progress.

But like I said programmers usually pick these up on the job not thru any course of study. There are some Linux, bash and SQL cookbooks for them as well.
 
Last edited:

FAQ: How do I learn programming, particularly bash shell scripting and SQL?

How do I start learning programming, particularly bash shell scripting and SQL?

To start learning programming, particularly bash shell scripting and SQL, you can begin by taking online courses or tutorials. There are many resources available that cater to beginners and provide step-by-step guidance on these topics. It's also helpful to practice writing code regularly and work on small projects to apply what you've learned.

What are the essential concepts to understand in bash shell scripting and SQL?

In bash shell scripting, it's important to understand basic commands, variables, loops, conditionals, functions, and file handling. In SQL, essential concepts include database design, querying data using SELECT statements, data manipulation using INSERT, UPDATE, DELETE statements, and creating and managing tables.

How can I improve my skills in bash shell scripting and SQL?

To improve your skills in bash shell scripting and SQL, you can challenge yourself with more complex problems and projects. Additionally, participating in coding challenges, joining online coding communities, and collaborating with others can help you learn new techniques and best practices.

Are there any recommended tools or software for practicing bash shell scripting and SQL?

For practicing bash shell scripting, popular tools include GNU Bash, ShellCheck, and Bash IDEs like Visual Studio Code or Sublime Text. For practicing SQL, tools like MySQL Workbench, pgAdmin, or SQLite are commonly used. These tools provide a user-friendly interface for writing and executing code.

What are some common mistakes to avoid when learning bash shell scripting and SQL?

Common mistakes to avoid when learning bash shell scripting and SQL include not understanding the basics thoroughly, not practicing enough, and not seeking help when needed. It's important to take your time to grasp the fundamental concepts before moving on to more advanced topics and to seek feedback from others to improve your skills.

Similar threads

Replies
9
Views
2K
Replies
3
Views
1K
Replies
10
Views
1K
Replies
1
Views
1K
Replies
13
Views
2K
Replies
3
Views
2K
Replies
11
Views
1K
Replies
8
Views
1K
Back
Top