Thread: Senseless but curious
So, I was dinking around in my virtual
linuxbox last night. Needed a little shortcut button on my home page. Couldn't get it fingered out right away, so searched around the innertubes for a while. Found what I needed and got it working. (small miracles are a blessing.)
While I was surfing for my solution I came upon a whole bunch of
tutorials on shell scripting. Some dumb as hell, but a few that were really good. For instance, I have been writing little 3-4-5 line scripts to do insanely stupid shit for a while, not knowing that you can do some really complex and complicated scripting right in the shell. Heretofore thinking that scripting like that was reserved for
Here's the senseless part: Given a largish text file, and the desire to manipulate the words and/or sentences from same file, and send the output to a different file; what's the diff between using sh (or csh or ksh or bash) and
php? Ya, I know, depends on a lot of things. Like what you are doing at the time, what scripting engine you like, and so on. But still:
Is there a performance hit for using one over the other?
Is there a speed issue for using one over the other?
If you invoke
PERLfrom the command line, you're starting another shell to handle it - so in fact, you're doing your RAM a favor by coding in the shell script.
That being said, there are nowhere near the number of functions and capabilities in shell scripting (even with the addition of tools like GREP and such) compared with a high-level lingo like
PHP, so it's really a choice of best tool for the job.
I personally have a bias against any language that uses "fi" to denote the end of an "if" block.
I like keeping my ram happy. So, I'll try some of the less demanding stuff from sh.
As a side note, there are a lot of shell scripts used to maintain a *nix system, so being conversant in shell scripting will *not* hurt you one bit D...
Ya, cool and painless. I likey.
Just tried a new one. Kinda short, but it ought to revolutionize my way of doing things.
|Best of The Cache Home|
|Search The Cache|
- Apache & mod_rewrite
- BlackHat SEO & Web Stuff
- C/++/#, Pascal etc.
- Database Stuff
- General & Non-Technical Discussion
- General programming, learning to code
- Linux Related
- Mac, iPhone & OS-X Stuff
- MS Windows Related
- PERL & Python Related
- PHP: Questions & Discussion
- PHP: Techniques, Classes & Examples
- Regular Expressions
- Uncategorized Threads