Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
01-04-2013, 08:11 AM
|
#1
|
Moderator
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 13,971
|
Bash shell scripting – Part I & Part II
Hi,
Link removed for attack violations;
EDIT: Look here; https://www.howtoforge.com/tutorial/...pting-lessons/
Quote:
This tutorial is a three part series as an introduction to Bash Shell Scripting. Part I is mainly basics of shell scripting and is generic, Part II will gradually move towards some more advanced techniques and focus mostly on the bash shell and finally in Part III we will try to use all the techniques to create working program.
A basic understanding of Linux shell is required for this tutorial. Please refer to Link removed for attack violations to learn more about Linux shell.
|
Link removed for attack violations;
EDIT: Look here; https://www.howtoforge.com/tutorial/...ing-lessons-2/
Quote:
In the Link removed for attack violations of this article series on shell scripting we covered basics of what shell scripting is and how we can use it like other programming languages to automate our work. Now we are going to cover some more advanced technique such as arrays, functions, networking etc which makes these shell scripts much more than just bunch of commands.
|
Other useful links in Links for Helpful Linux articles & books
EDIT: Look here for future references for Bash scripting; Advanced Bash-Scripting Guide sorry about the hijacked links above.
Last edited by onebuck; 03-07-2016 at 10:43 AM.
Reason: add link& remove attack violated links
|
|
|
01-04-2013, 09:51 AM
|
#2
|
Member
Registered: Mar 2011
Location: /
Distribution: Fedora (typically latest release or development release)
Posts: 372
Rep:
|
Aha! These are very nice tutorials.
Thanks for the links.
|
|
|
01-04-2013, 01:04 PM
|
#3
|
Member
Registered: Mar 2012
Posts: 311
Rep:
|
thanks for the links. this is exactly what i am learning right now. literally blocking everything out to learn it well.
edit: do you know of any good bash shell scripting books that are not too costly? I know I can get all this information free but I enjoy being outside and not having all the EMF's running through me, not to mention the glare of the laptops and battery drainage among other things just to read stuff. I feel more focused when I just have bash shell scripting in my hand with no access to anything else on my computer.
I came across this one which was written last January 2012, so its a year old. Is it worth it?
http://www.barnesandnoble.com/w/the-...1593273897&r=1
Last edited by rootaccess; 01-04-2013 at 02:55 PM.
|
|
|
01-05-2013, 04:18 AM
|
#4
|
Senior Member
Registered: Sep 2012
Posts: 1,385
|
As always: thanks about links
|
|
|
01-06-2013, 11:17 AM
|
#5
|
LQ Veteran
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Rep:
|
Quote:
Originally Posted by rootaccess
|
yes.
|
|
|
01-09-2013, 12:52 PM
|
#6
|
LQ Guru
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,352
|
Quote:
Originally Posted by rootaccess
|
It's available for free.
http://linuxcommand.org/tlcl.php
Last edited by dugan; 01-09-2013 at 01:11 PM.
|
|
|
01-09-2013, 02:07 PM
|
#7
|
Member
Registered: Mar 2012
Posts: 311
Rep:
|
I have the e-book. I was implying about the physical book. Sometimes I am away or don't feel like sitting on a chair just to read. I can't buy every physical book because that'll add up.
Also was considering the bash cookbook which seems pretty in-depth. 2007 edition
|
|
|
01-09-2013, 04:41 PM
|
#8
|
Senior Member
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,719
|
Quote:
Originally Posted by onebuck
|
there is too a cool epub book for free somewhere, gnu, oppen source epub about bash
|
|
|
01-09-2013, 05:07 PM
|
#9
|
Member
Registered: Sep 2009
Location: Oklahoma
Distribution: Mint, Debian, Almalinux
Posts: 898
Rep:
|
Nice post
Last edited by jmc1987; 01-09-2013 at 05:14 PM.
|
|
|
05-31-2013, 11:59 AM
|
#10
|
Member
Registered: Nov 2011
Distribution: Slackware
Posts: 363
Rep:
|
Thank you, this is very nice.
|
|
|
05-31-2013, 12:01 PM
|
#11
|
Senior Member
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,719
|
Quote:
Originally Posted by BloomingNutria
Thank you, this is very nice.
|
Why not coding in C? It is also very simple and more powerful
|
|
|
05-31-2013, 12:31 PM
|
#12
|
Moderator
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: Slackware®
Posts: 13,971
Original Poster
|
Member Response
Hi,
You can use a shell script to experiment before implementing a high level language program. Most times you will layout the problem and align task(s) requirement(s) then experiment via a simpler script using available commands.
Sometimes you won't even need to move to 'C' or other language to implement a simple task. Of course if the task is time restrictive then a program in a higher level language would/could be used.
More than one way to skin a cat!
|
|
|
05-31-2013, 01:20 PM
|
#13
|
Member
Registered: Nov 2011
Distribution: Slackware
Posts: 363
Rep:
|
Quote:
Originally Posted by Xeratul
Why not coding in C? It is also very simple and more powerful
|
I do code in C, and I appreciate it's power. But shell scripts are very prevalent throughout the Linux ecosystem, and it is helpful to be able to understand them so you can modify them and write your own when necessary.
|
|
|
05-31-2013, 05:17 PM
|
#14
|
LQ Newbie
Registered: May 2013
Posts: 8
Rep:
|
I know most of the stuff already, but I did picked up some new things mostly in part II
|
|
|
10-04-2013, 09:48 AM
|
#15
|
Senior Member
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683
|
@EVyshnavi
your posts are way off topic
but to answer your question,
you need to do a couple of things
first find out where olsrpkt.h is , then find out what references it in code
to find the file
Code:
find . -name olsrpkt.h
to find it in code
Code:
grep -r -n olsrpkt.h *
the -n will also display the line number
Warning:
What follows is not real...
it is just an example of one way to 'fix' it
you need to use some of your own brain power to achieve results
now, let us assume you find the file in
./somedir/another/include/um-olsr/olsrpkt.h ( I made it up )
and your 'code' is
Code:
#include <olsrpkt.h>
change it to
Code:
#include <um-olsr/olsrpkt.h>
you could do that with sed
Code:
for i in "$( grep -rlz olsrpkt.h * )";do sed -i 's#<olsrpkt.h>#<um-olsr/olsrpkt.h>#' "${i}"';done
or, if just one or two, just use vim to 'jump' to the line
Code:
vim path/to/file +<lineNumber>
or use whatever editor you are comfortable with ( well, not notepad as it will 'messup' the end of lines.. )
|
|
|
All times are GMT -5. The time now is 03:15 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|