LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 04-20-2022, 12:14 AM   #1
cinq
LQ Newbie
 
Registered: Apr 2022
Posts: 4

Rep: Reputation: 0
How do I learn linux shell scripting?


What is the best way to learn shell scripting in an easy way?
 
Old 04-20-2022, 06:45 AM   #2
dc.901
Senior Member
 
Registered: Aug 2018
Location: Atlanta, GA - USA
Distribution: CentOS/RHEL, openSuSE/SLES, Ubuntu
Posts: 1,005

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Quote:
Originally Posted by cinq View Post
What is the best way to learn shell scripting in an easy way?
When you say "easy way" that is highly subjective, something easy for you may not be easy for me and vice versa.
There's tons of materials on youtube and others that you can learn from. What have you tried already that was not "easy"?
And remember, only practice will make you better at it...
 
Old 04-20-2022, 06:47 AM   #3
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,596
Blog Entries: 19

Rep: Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455Reputation: 4455
If you have a traditional sysvinit boot, study the startup scripts. List a script at one terminal, try out individual steps at another to see what they actually do (but don't do that as root in case you damage something) and use a third terminal for calling up man pages.
 
Old 04-20-2022, 06:54 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,130

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Sitting here and seeing what problems arise and the solutions suggested is a great resource. Over time you will be able to solve them and contribute.

Time and practice.
 
Old 04-20-2022, 07:48 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,895

Rep: Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317Reputation: 7317
yes,
1. practice
3. practice
4. practice
.....
 
Old 04-20-2022, 08:03 AM   #6
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
Do you have any previous scripting or coding experience? If so, you might be able to get away with a reference guide or small tutorials.

This is a good Bash starter tutorial: https://www.youtube.com/watch?v=oxuRxtrO2Ag (Joe Collins - Beginner's Guide to the Bash Terminal)
 
Old 04-20-2022, 11:30 AM   #7
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
There are also tons of tutorials on bash and scripting that can be found with a search such as "bash tutorial".

While youtube has its place, the written tutorials are still quite relevant and more in-depth.

Last edited by computersavvy; 04-20-2022 at 11:32 AM.
 
Old 04-20-2022, 05:06 PM   #8
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,609

Rep: Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553
Quote:
Originally Posted by cinq View Post
What is the best way to learn shell scripting in an easy way?
Why do you want to learn shell scripting?

Give your other thread, the answer might be: by reading the websites/books/etc recommended by your teacher.

If you have such recommendations but do not find them easily understandable, identify them and explain what you find challenging. That way, people can recommend solutions without the same shortfalls and/or help you past those initial hurdles.

 
Old 04-20-2022, 05:20 PM   #9
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,665
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
Well, if you want to learn "shell scripting," maybe the very-first thing that you need to learn about is: #!shebang.

If the very-first line in your "shell script" file looks something like #!/usr/bin/php (for example ...), then the shell will immediately launch an instance of the specified "programming-language interpreter," and hand the rest of the contents of the file over to it. "And you will be none the wiser."

And so, what this means is that "you are not-at-all limited to 'shell scripting.'" Any full-featured programming language that is installed on your computer – and usually, there are several – can be used to carry out a "command."

The only "shell" that I am aware of which ever strived to incorporate "a programmingly-serious built-in scripting language" into itself was the Korn shell ... ksh. But it never really gained much traction. The "shebang!" principle was much more elegant. And, if you take a look around, you'll find that many of the "commands" that you use every day are implemented in this way.

The paltry "built-in" scripting capabilities of "the ubiquitous shell" are, most fortunately, irrelevant.

Last edited by sundialsvcs; 04-20-2022 at 05:23 PM.
 
  


Reply



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
win32,shell code,shell programming,shell scripting? mr.cracker Linux - Newbie 4 07-12-2013 11:20 PM
i want to learn shell scripting juglers Programming 12 04-12-2009 05:34 AM
Book to Learn Shell Scripting pramka Linux - Newbie 2 04-22-2008 02:55 AM
how to learn shell scripting G.Verma Linux - Laptop and Netbook 2 10-17-2007 06:55 AM
Want to learn Shell Scripting dawood Linux - General 3 08-04-2004 06:59 AM

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

All times are GMT -5. The time now is 08:09 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