You are not logged in.
Pages: 1
Topic closed
Today I needed to write a script that would copy a few of my dot files into a git repository. I cracked vim open and began to experiment with rudimentary bash constructs, but after a while gave up and decided to write the thing in Python, just because Python is simple and I know it.
Are there any good reasons as to why I should pursue a knowledge of bash with other, higher level languages around (e.g. Python) when bash's breadth of use is (relatively) limited?
Offline
I say if you're comfortable with python, and it does what you need it to do, then use python. There is no real "need" to learn Bash imo. personally I like bash for quick and dirty scripts, python for more elaborate scripts. but really it's just what ever you're happy using.
Hofstadter's Law:
It always takes longer than you expect, even when you take into account Hofstadter's Law.
Offline
I also find I am faster with bash for writing very simple scripts. If you plan on distributing scripts, I can imagine that some people would prefer bash versions. However, you certainly know better than anyone else whether python is fulfilling your needs in the best way. Python is using the shell for things like the "pipes" module, anyway.
A knowledge of bash is still useful, obviously, if you might be interested in editing bash scripts which other people have written, or want to distribute scripts where bash is expected. PKGBUILDs spring to mind.
"Computer Science is embarrassed by the computer." -- Alan J. Perlis
Offline
I say if you're comfortable with python, and it does what you need it to do, then use python. There is no real "need" to learn Bash imo. personally I like bash for quick and dirty scripts, python for more elaborate scripts. but really it's just what ever you're happy using.
Same here. I made an effort to do more with BASH this year and have written a few things in it. It is great for simple wrappers and adding functionality to your shell. I will sometimes use BASH for bootstrap style scripts as BASH is pretty much standard on most distros. It is in [core] whereas Python is in [extra]. This is probably less of an issue these days. All of my systems have Python installed. I still use Python for the heavy lifting as I know it can do just about anything.
Offline
Every Linux user should have a basic working knowledge of Bash for system scripting. Aliases and .bashrc functions can save a lot of typing, and simple tasks such as managing files and other basic command-line work are very quick and easy with Bash. It's really practical that you can script anything that you can do from a terminal. I wouldn't use it for anything big though and I often find myself switching between Bash and Perl for system scripting, depending on the intended scope and specific needs. I never use Python for system scripting unless I need a particular module.
trivial system task
Bash
Python
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
So what Xyne is saying is that Python sucks more than Bash? Unless, I suppose, if that is a vacuum made by Microsoft.
(There is a quote somewhere something like, "The day Microsoft makes a product that doesn't suck is the day they start selling vacuums," if you did not get it)
Offline
So what Xyne is saying is that Python sucks more than Bash? Unless, I suppose, if that is a vacuum made by Microsoft.
(There is a quote somewhere something like, "The day Microsoft makes a product that doesn't suck is the day they start selling vacuums," if you did not get it)
Yeah, that's in moljac's sig if I'm not mistaken.
On topic: If you can do what you want in python, by all means, use python. I'd consider being able to read the occasional bash script is enough, as long as you have something better/more versatile that you can rely on (python, in your case).
Also: Nice one, Xyne. ![]()
Offline
So what Xyne is saying is that Python sucks more than Bash? Unless, I suppose, if that is a vacuum made by Microsoft.
Heh. Oh the flame wars! ![]()
I say if you're comfortable with python, and it does what you need it to do, then use python. There is no real "need" to learn Bash imo. personally I like bash for quick and dirty scripts, python for more elaborate scripts. but really it's just what ever you're happy using.
Exactly my thoughts... If you can achieve the same thing 2 different ways and the result is the same, then do whatever is more comfortable/easier for you.
Although, if you'll excuse this little anecdote..... I used to *hate* perl, with a passion. I'd go out of my way to avoid it, because I didn't know it and when I tried to use it I found it esoteric and painful. Over the last few months though I had managed to get a (basic) grasp of perl, and now I love it. It can make things so much easier than doing the same in bash. The reverse is also true.
Moral of my anecdote (I think): Right Tool for the Right Job. The more tools you have (know), the easier to find a suitable tool for your task.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
So what Xyne is saying is that Python sucks more than Bash? Unless, I suppose, if that is a vacuum made by Microsoft.
![]()
*no comment*
Moral of my anecdote (I think): Right Tool for the Right Job. The more tools you have (know), the easier to find a suitable tool for your task.
indeed
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Personally, I'm still in the process of learning bash, and if you ask me...it is well worth it. I found a lot of really useful ways to automate daily tasks from editing mp3 tags to making full system back-ups with just one short script. Not only this, but I've also learned to customize the bash environment using .bash_profile and .bash_rc which also makes life considerably easier. So if you ask me, bash is definitally worth while learning, specially if you really go into the details, there won't be a single general task you can't do in the blink of an eye.
I can, however, also imagine that if you know either Perl or Python already, learning Bash might seem redundant. This is much dependent on the task at hand I believe, but for my purposes Bash is more than enough and therefore I have no considerable knowledge in Perl or Python.
Offline
Did anyone compare the speed of executing scripts bash v. dash? Dash uses less RAM so if you have 20 instances open on a 512 MB machine it may make a difference.
Offline
I generally prefer perl to bash, but when the task at hand calls for running a number of shell commands, I find bash is the way to go.
Like others have said, bash is worth knowing for a number of reasons. Like others, I have used .bashrc to fine-tune my shell and the results have been great. Heck, it's worth knowing for that reason alone.
Last edited by MercuryShadow (2010-05-20 15:57:16)
Offline
Did anyone compare the speed of executing scripts bash v. dash? Dash uses less RAM so if you have 20 instances open on a 512 MB machine it may make a difference.
That's comparing apples to oranges. Dash doesn't have the scope bash has; it has fewer builtins and lacks lots of other stuff bash has.
Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy
Offline
I've set dash as my shell on my other box and plan to call bash only if I need an interactive shell.
I think I will need to slightly modify some of my scripts, but I hope it's doable - I'm not a scripting heavyweight and I need just simple automation.
> Dash doesn't have the scope bash has; it has fewer builtins and lacks lots of other stuff bash has.
That's for sure. The questions is, do I need that many features?
Offline
Bash still worth learning?
Nope, zsh is far better. It has everything bash has and much more.
Offline
Well, even zsh is more lightweight on RAM-usage than bash. (And that is for me even though i use the grml-zsh-config that puts a *lot* of bloat in my zsh, like functions defined, and still is more lightweight than bash)
But dash to me is not usable for interactive. It can't even use left/right, you have to backspace to correct some typo..
(Apart form that once blessed by zsh tab completion i can never look back
)
Ogion
(my-dotfiles)
"People willing to trade their freedom for temporary security deserve neither and will lose both." - Benjamin Franklin
"Enlightenment is man's leaving his self-caused immaturity." - Immanuel Kant
Offline
> But dash to me is not usable for interactive. It can't even use left/right, you have to backspace to correct some typo..
Funny, I can use all vi-keybindings in bash - left/right too :-)
Offline
"dash", not bash.
Ogion
(my-dotfiles)
"People willing to trade their freedom for temporary security deserve neither and will lose both." - Benjamin Franklin
"Enlightenment is man's leaving his self-caused immaturity." - Immanuel Kant
Offline
<facepalm> OMG, sorry for that, Ogion.
Dash *is not* an interactive shell. A shell doesn't have to be interactive, it has to run commands. 'fc' &c would make dash more suited for interactive use, but
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=252498
Since interactive use isn't very high on my agenda, I haven't devoted any time to it yet. You're welcome to either build it with libedit or try the libreadline approach.
Offline
Dash *is not* an interactive shell.
++
dash is primarily used because it's pretty close to the least common denominator of POSIX-like shells. (Back in the day, I hear people used to use the C shell for interactive use and Bourne shell only for scripts. That was before bash.)
As for bash... it's really very useful. I have spent hardly any time at all learning bash syntax but it worked its way into my brain anyway. I kind of wish I had learned earlier, but it's not useful for everything. bash is my interactive shell, so I use it when I need to do something that I can describe quickly enough that it wouldn't be worth the trouble to do it in Perl. Those things aren't very common, though, in part because my Perl is better than my bash ![]()
Offline
Kiwi wrote:So what Xyne is saying is that Python sucks more than Bash? Unless, I suppose, if that is a vacuum made by Microsoft.
(There is a quote somewhere something like, "The day Microsoft makes a product that doesn't suck is the day they start selling vacuums," if you did not get it)
Yeah, that's in moljac's sig if I'm not mistaken.
On topic: If you can do what you want in python, by all means, use python. I'd consider being able to read the occasional bash script is enough, as long as you have something better/more versatile that you can rely on (python, in your case).
Also: Nice one, Xyne.
Signiture reporting for duty.
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...
Offline
No.
No.
No, don't waste any time trying to learn Unix shell scripting of any kind.
Always use anything else.
If you run across a Unix shell script, transcribe it into something useful.
If for any reason you are unable, delete it and forget it ever existed.
If someone misses it, convince them to write it from scratch or die trying.
No matter what happens, never try to learn, use, write or in any way be in contact with Unix shell scripts of any kind, ever.
Unix shell scripts are useful for one thing and one thing only; learning whichever language you choose to rewrite them in.
Offline
Trolling and necrobumping on your first post? Don't.
https://wiki.archlinux.org/index.php/Fo … Bumping.27
Closing
Offline
Hi Teekin. Welcome to Arch Linux.
This thread is so old that many of the moderators (who are present in this ancient thread) were newbies at the time they posted. BTW, I hope you are being facetious about learning bash.
Closing this thread. Please be aware of our policy on old threads.
Edit: Once again, Jasonwryan is faster than me.
Last edited by ewaller (2014-08-29 04:22:17)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Offline
Pages: 1
Topic closed