31

I have seen a number of users voting to close scripting questions as off topic. Is this the community consensus? Are bash questions not welcome here? How about other shell programming questions?

  • 19
    Of course they're on-topic here. Always have been. I, like yourself, am quite disturbed at all the close votes I see on shell questions. – Seth Apr 9 '15 at 16:38
  • 2
    I generally like scripting questions (though ones that are basically do my homework can be annoying....) – Wilf Apr 14 '15 at 17:55
30

The help center states that (emphasis mine):

Using and administering official Ubuntu flavors including: Edubuntu, Ubuntu GNOME, Kubuntu, Ubuntu Kylin, Lubuntu, Mythbuntu, Ubuntu Studio, Xubuntu, Ubuntu Touch and Ubuntu MATE.

Shell scripting is an essential part of administering (and using, really) a Linux system. Including Ubuntu.

We also have a meta discussion that has been well accepted and which states that:

Bash is the default shell on Ubuntu. Shell scripting is an integral part of managing a Linux system. I believe that all bash related questions are on-topic, even the ones that have to do clearly with programming tasks like how to add 1 to a variable.

As far as I can tell, these all mean that bash questions, any bash questions are welcome and on topic here. This should also apply to any other shell since they are all basic Linux tools and are easily available on Ubuntu. In any case, bash most certainly is on topic.

To illustrate, we currently have

  • 2,848 questions tagged with
  • 83 questions tagged with
  • 21 questions tagged with one of , or .
  • 46 questions tagged with
  • 537 questions tagged with
  • 1,553 questions tagged with
  • 1,722 questions tagged with
  • 139 questions tagged with

So, in conclusion, yes shell scripting questions are perfectly on topic and welcome here. Please stop closing such questions as off topic.

  • This is, of course, just my opinion. If anyone disagrees, please post another answer and downvote this one. I am hoping this thread will serve as a conclusive answer to the question. – terdon Apr 9 '15 at 16:34
  • Can you elaborate on where the line should be drawn? I mean, exactly where other programming languages are on topic and where not. – kos Apr 9 '15 at 17:42
  • @kos anything you do on ubuntu essentially. So php if you use an apache server, python etc. that's not to say that this is the best place, but it is on topic. – Tim Apr 9 '15 at 19:50
  • @Tim That's what I deduce either, the problem is I've seen lots of questions migrated to Stack Overflow with no scope disclosed whatsoever about their purpose. So I wondered on which basis they have been migrated at all – kos Apr 9 '15 at 20:04
  • 1
    @kos they shouldn't have been migrated to be honest - unless there is no mention of ubuntu at all. I would advise a user to ask on Stack Overflow because then they would get a better(?) answer. But I'd never migrate. – Tim Apr 9 '15 at 20:05
  • 3
    I believe that straight-up shell/bash scripting for Ubuntu is okay here, but questions relating to specific languages (Python/C++/etc.) should be asked on either StackOverflow or Programmers as those boards are for actual programming rather than scripting. – user323419 Apr 10 '15 at 5:03
  • @Tim Let me come back on what I said, to migrate them is a good thing, since they fit better there. I just don't think the scope makes up a good baseline to decide, because of course it's always about Ubuntu. If I'm building an app for Ubuntu that would clearly fit here, but the truth is it would fit better on Stack Overflow. By the way here's the list of the most recent migrated questions from Ask Ubuntu to Stack Overflow – kos Apr 10 '15 at 9:06
  • @DonaldBrown Python by the way it's still a scripting language. I don't think that's a good criterium, that way I could just ask everything about developing my PHP webapp over here, while this is clearly intended to be done on Stack Overflow – kos Apr 10 '15 at 9:11
  • @kos they were migrated because they didn't mention ubuntu at all. We have ~2000 python questions: askubuntu.com/tags – Tim Apr 10 '15 at 9:11
  • 1
    Both of those should be here (esp the first one). – Tim Apr 10 '15 at 9:25
  • 1
    @kos that is why I clarified bash/shell and not scripting in general. – user323419 Apr 10 '15 at 12:28
  • 1
    @DonaldBrown the help center also mentions "Development on Ubuntu." as on-topic. That means that pretty much anything about coding on an Ubuntu system would be on topic. My personal rule of thumb is that if it's a few lines of code that are run on Ubuntu, it's on topic, if it's a large program, it's not. Also, if the problem is about interacting with the Ubuntu system, it's on topic, if the issue is about the right syntax in C, then it is not. [cont...] – terdon Apr 10 '15 at 12:34
  • 1
    @kos I know, and I'm not frustrated :). This post is intended as a discussion. I read development on Ubuntu as describing questions that arise because the development is on Ubuntu. If you would have the same issue on any OS, that's not really on topic. I could use Ubuntu to write a windows app, for example, that doesn't mean that the Windows API is on topic here. – terdon Apr 10 '15 at 14:13
  • 1
    @terdon Possibly the way to correctly read that statement in the help center is your way. Ok so it looks like almost everyone agrees on the fact that to be on-topic it should be mentioned that the specific issue is related to developing either for the Ubuntu platform or on the Ubuntu platform (the latter meaning that the specific issue is platform dependant, including for example development software). Well I think that all this put together is pretty consistent to be used as a baseline – kos Apr 10 '15 at 14:23
  • 2
    @ElderGeek yes, the line can be blurry. For me, if the question is about interacting with an Ubuntu system (how do I use this Linux API call, for example) it's on topic. If it's about the particular programming language in general (How do I convert a floating point number to an integer in C?) it would be a better fit elsewhere. – terdon Apr 11 '15 at 22:47
20

As terdon says, bash scripting differs from some other programming tasks in that writing shell scripts is a core part of system administration on Ubuntu and other Unix-like operating systems. Not every Ubuntu user writes or needs to write their own shell scripts, but bash scripting is a topic is central to system administration on Ubuntu. Furthermore, there is enormous overlap between bash usage and bash scripting. Even users who rarely or never write scrips are likely use the bash shell (in the terminal) sometimes.

Bash is so central to Ubuntu, I doubt a universal rule about all programming questions has to be articulated to clarify that bash is on-topic. I'm not objecting to having such a rule--I just think bash being on-topic is much more clear cut.

When you open a Terminal window, that's bash. (Unless you have changed your shell.) A huge number of answers to a wide variety of questions about different Ubuntu topics advise to run commands in a Terminal, and those commands are run by bash. We often comment to ask users to run bash commands to gather missing information for their questions, as well. To declare bash scripting off-topic for this site would, it seems to me, be extreme and inadvisable.

Questions about running a bash script on Ubuntu are thus virtually always on-topic for this site, unless some completely unrelated factor makes them off-topic.

For example:

  • A bash scripting question that's attempting to report a bug rather than ask a question would be off-topic, just like any other bug report.
  • If someone who isn't using Ubuntu at all asks a bash scripting question, that would be off-topic.

But there's nothing about the topic of bash scripting that makes a question any more likely to be off-topic, compared to questions about any other core Ubuntu-related topic.

Furthermore, even in the cases where a bash scripting question happens to be off-topic for an unrelated reason, the actual reason for closure should be made clear, so people are not misled about our policies or about the technical relationship between Ubuntu and the bash shell.


I think one of the reasons users are sometimes inclined to try to push bash scripting questions off the site is that there are several Stack Exchange sites where such questions are on-topic. Sometimes reviewers think a question would have been better asked elsewhere, even if it is strictly speaking on topic here. But there are at least four problems with closing bash questions for that reason:

  • Bash is a critically important part of Ubuntu, and people should feel (and be) welcome to ask questions about it here.
  • We don't have a policy that such questions are off-topic. I hope we never have such a policy, but even if one day we do, we don't right now and it is a misuse of the system to close on-topic questions based on one's personal preferences.
  • Users experienced on Ask Ubuntu often don't know when a question would be a better fit for another site. For example, sometimes someone posts a bash question that is poorly researched or unclear and is told in comments to ask it on Stack Overflow. But without modifications the question would not be welcome there; even if it needs to be closed here, we should not simply advise them to go ask it there. This doesn't help the OP, and is actively bad for Stack Overflow.
  • When a question is on-topic on the site where it is asked, network-wide policy says we should not push it off to another site.

This last point is worth explaining and elaborating. As community manager Shog9 wrote in Respect the community – your own, and others’:

Respecting your own community

As members of a community, your first loyalty should be to that community. When evaluating a question, you shouldn’t be looking to push it off on some other site; instead, ask if it could be appropriate and on-topic for you, the experts who the author decided to ask. Be a bit jealous of your site – don’t blithely turn askers away simply because their question could be asked somewhere else. Don’t hit them over the head with your scope, help them tailor their question to fit into it – and if that means your site’s scope overlaps a bit with another site’s, so be it.

  • Given that the "related questions" sidebar only works on the local site, isn't that a reason to migrate questions to sites where they fit best? – Peter Cordes Apr 17 '15 at 20:15
  • "Bash is a critically important part of Ubuntu" Is not. On my 17.10 system the only package that depends on bash is bash-completion. – fkraiem Nov 19 '17 at 6:24
  • @fkraiem (a) Please consider that bash has required priority. If you don't know what that means, run apt show bash or apt -s remove bash (the -s reduces the risk of harm to your system as it only simulates the removal of this essential package). It's odd--and self-defeating--to cite the bash package in defense of the idea Bash isn't a critically important part of Ubuntu, as the bash package is officially a critically important part of Ubuntu. (b) Please consider that the importance of software is primarily the effect of how it's used in real life. Bash is very heavily used. – Eliah Kagan Nov 19 '17 at 6:51
  • Wasn't it the whole point of the "migration" to Dash to make Bash only used as an interactive shell? If that is the case, then any user can replace it with another shell, as many do, and Bash is merely the default (not quite the same thing as being "crucial"). – fkraiem Nov 19 '17 at 6:59
  • @fkraiem The point of migration to Dash was to make /bin/sh dash (as it now is), not that users and administrators would cease scripting in Bash. Further, the actual practice of the vast majority of Ubuntu users is to have /bin/bash as their initial login shell (usually configured in /etc/passwd), which also happens by default when a new account is created. Removing bash would prevent most human users of most Ubuntu systems from logging in on a virtual console or via SSH. But that understates the situation: bash has required priority so anything is free to assume it is present. – Eliah Kagan Nov 19 '17 at 7:07
-7

stackexchange's "related questions" sidebar only works per-site. Having bash questions scattered around is a bad thing, isn't it?

Currently, there's shell stuff on

  • stackoverflow: 50,496 tagged questions, 5,610 unanswered
  • unix: 5,870 tagged questions, 355 unanswered
  • askubuntu: 2,873 tagged questions, 380 unanswered

It looks like users are mostly asking questions in the right places. (except for shell programming questions still on stackoverflow, now that unix has been created).

Ubuntu-admin scripting questions on this site, like How do I force nmcli to reconnect to different uuid? on askubuntu, while Unix attract general shell programming stuff like like https://unix.stackexchange.com/questions/196885/bash-eq-vs-and-bc-output-type.

So mostly the bash questions asked here do belong here.

The problem I see is that shell-programming questions are getting split between stackoverflow and unix. Even though stackoverflow has the many valuable answered questions about shell programming, I think Unix is the best site for them. As terdon pointed, shell scripting is really Unix's speciality.

stackoverflow still attracts recent shell programming questions, like https://stackoverflow.com/questions/29707776/bash-replace-two-variables-in-order-with-loop, that would be best on Unix.

I'd like to see shell programming questions that aren't specific to Ubuntu or to sysadmin in general moved to unix. Esp. if the question is more "how to get the shell to do what I want?" (where the answer is a clever use of a for loops, cut, sed, awk, or similar). Questions asking about Ubuntu (or generic Unix) sysadmin tasks that happen to be best accomplished by shell scripting are fine here. Questions like "what should I get the shell to do? (to accomplish this sysadmin goal)".

I'd just like to see the shell programming questions (like, clever uses for for loops, or for bash arrays) all go on the same site.

This probably isn't a popular view here, but I think I don't see why there's an askubuntu, AND a Unix & Linux. Couldn't everything from this site just go on unix.stackexchange without making it hard to find ubuntu-specific stuff, and without burying the non-Ubuntu questions? Maybe the answer is no, but having the "related questions" sidebar miss out on good stuff because someone asked it on another site isn't ideal.

  • I have no idea why this was downvoted. It's not because I'm disagreeing with people about general-purpose scripting questions being on-topic here instead of unix or stackoverflow, is it? – Peter Cordes Apr 18 '15 at 2:07
  • 5
    Remember that on meta, votes usually indicate simple disagreement, don't take it personally. Yes, apparently some people, myself included, disagree with your answer. I see no benefit to anyone in sending shell scripting questions to be lost in the abyss of Stack Overflow. They're on topic here, and extremely on topic on Unix & Linux, let them stay where they are asked. Personally, and I admit I might not be entirely impartial here, I would hate to see Stack Overflow take the scripting questions away from the *nix sites. Scripting is *nix and they belong there. – terdon Apr 18 '15 at 11:34
  • Thanks for the heads up about voting. I still think that unless stackexchange gets better about handling topics across sites, it's preferable to have everything in a subject on one site, so "related questions", search, and tags work properly. I agree with your point that stackoverflow isn't the ideal place, even though it has a huge amount of existing answered questions. Updated my answer to take out "or stackoverflow" in a few places – Peter Cordes Apr 18 '15 at 11:52
  • Actually ended up making a more substantial edit. – Peter Cordes Apr 18 '15 at 12:08
  • And intra-network linking is not going to happen any time soon -- more likely at all, which I think is a real shame, but c'est la vie. Plus ça [StackEx]change, etc. – Dɑvïd Apr 20 '15 at 20:29
  • Ok, then I stand by my stance that it would be ideal if questions could be sent where they belong, to keep related questions on the same site as much as possible. This is only good if it can be done without closing questions and forcing a re-ask, but rather by moderators moving them so it looks like it was posted on the correct site in the first place. – Peter Cordes Apr 20 '15 at 21:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .