LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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

Reply
 
Search this Thread
Old 01-04-2013, 07:11 AM   #1
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: Slackware®
Posts: 11,320
Blog Entries: 3

Rep: Reputation: 1464Reputation: 1464Reputation: 1464Reputation: 1464Reputation: 1464Reputation: 1464Reputation: 1464Reputation: 1464Reputation: 1464Reputation: 1464
Bash shell scripting – Part I & Part II


Hi,

Bash shell scripting – Part I;
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 Introduction to Linux Shell and Introduction to Shell Environment to learn more about Linux shell.
Bash shell scripting – Part II;
Quote:
In the first part 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

Last edited by onebuck; 05-26-2013 at 10:17 AM. Reason: add link
 
Old 01-04-2013, 08:51 AM   #2
nonamedotc
Member
 
Registered: Mar 2011
Posts: 343

Rep: Reputation: Disabled
Aha! These are very nice tutorials.

Thanks for the links.
 
Old 01-04-2013, 12:04 PM   #3
rootaccess
Member
 
Registered: Mar 2012
Posts: 211

Rep: Reputation: Disabled
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 01:55 PM.
 
Old 01-05-2013, 03:18 AM   #4
kooru
Senior Member
 
Registered: Sep 2012
Location: Italy
Distribution: Slackware, NetBSD
Posts: 1,334
Blog Entries: 5

Rep: Reputation: 262Reputation: 262Reputation: 262
As always: thanks about links
 
Old 01-06-2013, 10:17 AM   #5
Habitual
Senior Member
 
Registered: Jan 2011
Distribution: Undecided
Posts: 3,493
Blog Entries: 6

Rep: Reputation: Disabled
Quote:
Originally Posted by rootaccess View Post
yes.
 
Old 01-09-2013, 11:52 AM   #6
dugan
Senior Member
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 4,790

Rep: Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486
Quote:
Originally Posted by rootaccess View Post
It's available for free.

http://linuxcommand.org/tlcl.php

Last edited by dugan; 01-09-2013 at 12:11 PM.
 
Old 01-09-2013, 01:07 PM   #7
rootaccess
Member
 
Registered: Mar 2012
Posts: 211

Rep: Reputation: Disabled
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
 
Old 01-09-2013, 03:41 PM   #8
Xeratul
Senior Member
 
Registered: Jun 2006
Location: Debian Land
Posts: 1,358

Rep: Reputation: 83
Quote:
Originally Posted by onebuck View Post
there is too a cool epub book for free somewhere, gnu, oppen source epub about bash
 
Old 01-09-2013, 04:07 PM   #9
jmc1987
Member
 
Registered: Sep 2009
Location: Oklahoma
Distribution: Debian, CentOS, windows 7
Posts: 866

Rep: Reputation: 110Reputation: 110
Nice post

Last edited by jmc1987; 01-09-2013 at 04:14 PM.
 
Old 05-31-2013, 10:59 AM   #10
Kallaste
Member
 
Registered: Nov 2011
Distribution: Slackware
Posts: 344

Rep: Reputation: 84
Thank you, this is very nice.
 
Old 05-31-2013, 11:01 AM   #11
Xeratul
Senior Member
 
Registered: Jun 2006
Location: Debian Land
Posts: 1,358

Rep: Reputation: 83
Quote:
Originally Posted by BloomingNutria View Post
Thank you, this is very nice.
Why not coding in C? It is also very simple and more powerful
 
Old 05-31-2013, 11:31 AM   #12
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: Slackware®
Posts: 11,320
Blog Entries: 3

Original Poster
Rep: Reputation: 1464Reputation: 1464Reputation: 1464Reputation: 1464Reputation: 1464Reputation: 1464Reputation: 1464Reputation: 1464Reputation: 1464Reputation: 1464
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!
 
Old 05-31-2013, 12:20 PM   #13
Kallaste
Member
 
Registered: Nov 2011
Distribution: Slackware
Posts: 344

Rep: Reputation: 84
Quote:
Originally Posted by Xeratul View Post
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.
 
Old 05-31-2013, 04:17 PM   #14
WHITE_POWER
LQ Newbie
 
Registered: May 2013
Posts: 8

Rep: Reputation: Disabled
I know most of the stuff already, but I did picked up some new things mostly in part II
 
Old 10-04-2013, 08:48 AM   #15
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian Jessie / sid
Posts: 1,471

Rep: Reputation: 444Reputation: 444Reputation: 444Reputation: 444Reputation: 444
@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.. )
 
  


Reply

Tags
bash, environments, programming, script, shell


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Scripting the Linux desktop, Part 2: Scripting Nautilus LXer Syndicated Linux News 0 02-17-2011 04:02 AM
bash shell script read file word by word part 2 justina Programming 7 01-25-2011 01:19 PM
LXer: 8 More Bash Tips for Working Faster With the Shell (Part 2 of 2) LXer Syndicated Linux News 0 12-23-2010 12:20 PM
LXer: 10 Bash Tips for Working Faster With the Shell (Part 1 of 2) LXer Syndicated Linux News 0 12-20-2010 01:50 PM
bash shell scripting - && and || gui10 Programming 10 12-15-2001 03:37 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration