ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
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.
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986
Rep:
New angle: What can't I do with Bash?
I think I made a post before of "BASH projects" and the response was disappointing but the need is still there. So I'll guess I'll make a list and see if I can get a yes ,a no and some expanding on the subject.
I believe BASH can do a lot with Text files on a users computer but...
1. Can it automate a browser and turn it into a dataminer or something? Can bash use a programs API?
2. Can bash filter and sound an alert if certain Java script commands are made by a server?
Are theses ambitions too tall?
I'm mostly interested in what BASH can do as far as the internet is concerned. I would like to know the practical limitations of BASH. Any Scripts that you have written for a purpose would be of interests.Not the actual scripts , just the purpose.
Thanks in advance
Last edited by theKbStockpiler; 03-07-2011 at 04:48 PM.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Quote:
Originally Posted by theKbStockpiler
1. Can it automate a browser and turn it into a dataminer or something? Can bash use a programs API?
Depends on the API. If you can run it like a Bash command it is possible, if you need to link against C libraries or so it is not. Take "running as a command" not to strict. If you have a Perl program accessing a certain API, you can call a Perl script from Bash, where the Perl script simply relays the Bash string to the API, and returns the result to the command line. For API's like MySQL which do have a Bash client it is very easy.
Quote:
Originally Posted by theKbStockpiler
2. Can bash filter and sound an alert if certain Java script commands are made by a server?
Javascript commands are not produced by a server but by a Javascript interpreting application (usually a Web browser). If that client has an API which can be accessed by some script which happens to have the correct bindings, answer#1 applies. However, if page content is generated by a server you could get the web page and awk/grep for something you want to know.
Quote:
Originally Posted by theKbStockpiler
Are theses ambitions too tall?
No, but you should remember that everything can be called from Bash and it is up to you to decide where you still want to call something Bash if you have to use a number of glue scripts. Secondly, it is always a good idea to use the language best suited for a project. If I have to do something which is mostly running commands and file handling and a single MySQL statement, I choose Bash. If, however, the essential part of the program comprises real heavy database access and heavy processing of the return values I might choose TCL or PHP.
I think I made a post before of "BASH projects" and the response was disappointing but the need is still there. So I'll guess I'll make a list and see if I can get a yes ,a no and some expanding on the subject.
I believe BASH can do a lot with Text files on a users computer but...
1. Can it automate a browser and turn it into a dataminer or something? Can bash use a programs API?
2. Can bash filter and sound an alert if certain Java script commands are made by a server?
Are theses ambitions too tall?
I'm mostly interested in what BASH can do as far as the internet is concerned. I would like to know the practical limitations of BASH. Any Scripts that you have written for a purpose would be of interests.Not the actual scripts , just the purpose.
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986
Original Poster
Rep:
We use BASH because it is there. It has mass and takes up space.
Part of this is fueled by learning bits and pieces of Four Programming languages and Assuming that BASH is the most important for an Administrator Role. If I wish to be (Administrator Centered) when do I have to venture outside of BASH's abilities? What are BASH's abilities?
BASH just looks like an interface for applications that don't have one and a reusable one at that. If it runs in BASH it is using BASH as a terminal. BASH runs applications that are usually not part of it. I'm not going to look it up but the best description of BASH I received was that BASH is an application it's self which has helped my understanding of it immensely. So these non-stand alone applications run in BASH's environment which means that BASH is just mostly a environment for environment-less applications to run. BASH has control features and allows the output of one application to be the input of another. BASH also conveys the feedback of if the process was successful or not. So in a way BASH behaves as a configurable Operating System for Raw Applications that are not finished to STAND on their own.
Am I wrong here? Is BASH Limited to what it will host as an application and behaves as an orchestra conductor? Would this assumption have been 100% percent correct with it's origial release but applications were purposely made for it to run? Now it is sort of both?
As I grow as a user and accept CLI it looks more and more like a temporary fix or a problem that users don't want to accept ,maybe to experiment with or something you don't want to commit to. Having human readable files would be the only benefit. BASH looks experimental and makeshift which are admirable qualities!
Last edited by theKbStockpiler; 04-02-2011 at 09:19 PM.
Am I wrong here? Is BASH Limited to what it will host as an application and behaves as an orchestra conductor? Would this assumption have been 100% percent correct with it's origial release but applications were purposely made for it to run? Now it is sort of both?
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986
Original Poster
Rep:
I'll try to explain.
From what I can tell BASH started off as JUST an interpreter and over time became an interpreter that housed a few applications it's self so it's persona is that of something more than a lousy interpreter mainly because GUI's are not readily produced to remove it's need for utilities. I'm not trying to indiscriminatlely make a point to marginalize BASH ; (Edit) but BASH is just looking like a glamorized interpreter at this point.
Last edited by theKbStockpiler; 04-02-2011 at 09:15 PM.
... BASH is just mostly a environment for environment-less applications to run. ...
Huh ?
...
It think you are approaching all this (administrator role) from a wrong end. It's like you are carefully studying a set of wrenches used to tune/fix an internal combustion engine not understanding how the engine works in the first place.
...
For administrator role you better learn POSIX compliant (and limited) shells. I.e. don't count on all BASH features because nowadays not every system uses BASH as its default shell, e.g. look up "dash shell".
BASH just looks like an interface for applications that don't have one and a reusable one at that. If it runs in BASH it is using BASH as a terminal. BASH runs applications that are usually not part of it. I'm not going to look it up but the best description of BASH I received was that BASH is an application it's self which has helped my understanding of it immensely. So these non-stand alone applications run in BASH's environment which means that BASH is just mostly a environment for environment-less applications to run. BASH has control features and allows the output of one application to be the input of another. BASH also conveys the feedback of if the process was successful or not. So in a way BASH behaves as a configurable Operating System for Raw Applications that are not finished to STAND on their own.
Most of this is either untrue, or only makes sense or has meaning in your own way of thinking.
I think you are over-thinking a lot of what Bash is and does. Think about what any shell does as its root purpose, which is to invoke other processes in a way that a user can specify. This may be interactively, as with a keyboard, or through scripts stored in files. Everything else is just some add-ons to make it do its root job 'better'.
The set of 'add-ons' includes a whole host of categories such as iteration, branching and other procedural logic, management of standard IO, text manipulation, creation and management of environment-based data structures, etc. As soon as your requirements for a task involve much or any of the things outside of Bash's (or any other shell) core competencies, then it probably shouldn't be a shell application. I would say that there are many cases where another programming language is better suited to jobs done strictly with Bash; even a few I've done myself.
It is sometimes difficult to define what is a Bash application. If I wrap the invocation of Firefox in a bash script, is that application principally a shell script? What about if we call sed or grep instead of Firefox? In the end, it doesn't really matter.
A common exercise in college computing courses is to write a shell. This forces the student to think about the purpose of a shell, and also forces the student to understand a bit about the Unix process model, and the concepts of standard IO. It is surprisingly easy to write a functional shell in a language like C, especially if you allow the use of ready-made components like the readline library. I suggest that you give it a try; you'll gain a lot of understanding.
Distribution: RPM Distros,Mostly Mandrake Forks;Drake Tools/Utilities all the way!GO MAGEIA!!!
Posts: 986
Original Poster
Rep:
Thanks for the Replies!
I really should have used the term CLI instead of environment. I use the term environment in a broader sense of the (Users Environment). A lot of my interpretation of BASH is from what Does Not happen when you open a BASH Application directly which is (nothing happens). I had a previous thread where it was discovered that most of BASH's ability is from controlling other separate applications that are not stored within BASH. This goes against the common belief of what defines BASH. Pick some BASH commands and chances are they are in /bin in a binary format. This is not BASH.BASH can find it and run it though.
The quoted paragraph is exaggerated to make a point of it being an understated concept. Quite often people will over emphasize a trivial concept that actually behaves as a negative by mentioning it. Why do they bother? So if I run a command which is in binary form sitting in /bin how does the user interact with it? CLI, and not GUI. So BASH in this broad sense is the users interactive environment for the command. How do I implement arguments? BASH.Thanks for dropping the (redline library) direction but I'm missing the point. When you state (shell) you really mean script correct,and you are not programming a interpreter you would be writing shell scripts?
Last edited by theKbStockpiler; 04-03-2011 at 08:56 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.