14

Stack Overflow has a [bash] tag that people use and seem to like. But... don't most of those questions belong on unix.stackexchange.com? Like this question which is clearly about the linux command line and common utilities? Sometimes I see questions get moved, like this one that I answered, which ended up on.... SuperUser? Is it ever OK to ask questions that are purely about *nix command line on SO? When should they be moved, and where to?

Edit: What about this one? Move multiple files with unique name to new folder and append to file name

7
  • 6
    These questions are clearly on-topic on SO as well. Commented Oct 31, 2014 at 3:07
  • @πάνταῥεῖ Really? Then why did the second one I linked to get moved to SU? I thought stackoverflow was for programming? I'm trying to get a definitive answer here so I know when to flag questions in the future. I think the downvote was unnecessary and if instead you wanted to answer with why these questions are on topic, that would be more helpful.
    – ErlVolton
    Commented Oct 31, 2014 at 3:10
  • 16
    " I thought stackoverflow was for programming?" Doesn't shell scripting count as programming anymore?? Commented Oct 31, 2014 at 3:12
  • 1
    @πάνταῥεῖ I think it does, actually, so is that the answer? They're on topic because shell scripting is programming? That's half of it, the other half is why did that question get moved then?
    – ErlVolton
    Commented Oct 31, 2014 at 3:12
  • 3
    If scripting wasn't programming we'd need to move quite a few questions. However, this doesn't strike me as a question about programming. It's asking about how to use a command-line tool. The other question you linked is IMHO borderline, but at least the OP mentions that they're trying to create a script.
    – ivarni
    Commented Oct 31, 2014 at 6:18
  • Is the decision between SU and unix.SE based on skill level of the asker? Or can anyone shed light on that?
    – ErlVolton
    Commented Oct 31, 2014 at 13:45
  • @ErlVolton I'd say SU is more general, whereas someone who runs unix/linux would be needed for more obscure unix/linux commands. I'd drop those on unix, and (for example) powershell/cmd.exe questions on SU.
    – user1228
    Commented Nov 7, 2014 at 20:20

4 Answers 4

19

I believe I'm in the minority when it comes to this subject, but I'll add it as an answer and let the voters decide.

I think shell questions should be off topic on Stack Overflow unless your question is specifically about scripting the shell.

Some people seem to have a problem with this distinction. They seem to think that help with a shell command is "scripting". I would argue that it is not. Let me try to illustrate the distinction with an example from your first linked question. The OP states:

I'm new to bash (started with DOS circa.1983), so need some help with crafting a script that will list folders & files in the backup folder not found anywhere in the source folder, OR files that are physically identical but in different folders.

Although a crap question (code my bash script for me), the task that the OP is trying to achieve appears to be complex enough as to require the creation of a script to accomplish. It seems like it would require listing directories, piping the result to some kind of parser, piping that result to something that would find the differences, and finally to something that would resolve those differences by copying files. Of course, I'm not a bash script writer, so I am completely wrong. From your answer:

rsync --delete --update --archive SOURCE_FOLDER/ SAME_FOLDER_NAME

is all that is needed to accomplish the OP's goal. This is not a script. It's a command. rsync is a file transfer program found on unix boxes. Stack Overflow is not the place to ask about what command line arguments to pass to rsync in order to back up a directory onto archive media. That has about as much to do with programming as asking how to start Steam up in full-screen mode.

I believe the line should be drawn here. If you are scripting, then you're welcome here. If you are simply executing a command line application, go ask on Unix & Linux or Super User.

3
  • I had to make an excuse to the people around me for why I bursted out laughing at "start Steam up in full-screen mode." Bravo!
    – ErlVolton
    Commented Oct 31, 2014 at 15:48
  • 4
    Are you suggesting that a question may be secretly off-topic if the solution is more straightforward than the asker thought?
    – Sneftel
    Commented Feb 8, 2019 at 10:04
  • So the question is about programming but the answer is "you don't need to do any programming". I'd say that is on topic for SO.
    – JeremyP
    Commented Feb 8, 2019 at 10:58
10

There is some overlap between Stack Overflow (about programming) and sites about computer usage (Super User, Unix & Linux, Ask Ubuntu, Ask Different, …).

  • If a question is about interactive command line use, it's off-topic on SO. Example. This is especially true if the question isn't about the shell itself, but about some external utility.
  • If a question is about configuring the shell for interactive use (prompt, completion, etc.), it's generally off-topic on SO. Writing a non-trivial completion or line edition function would be on-topic, however.
  • If the question is about automating a task (file management, text processing, etc.), then it's usually on-topic on SO. However, SO frowns on questions that ask how to perform a task and prefers questions to contain non-working code; SU, U&L, etc. are better places for questions that just ask how to perform the task. You can flag or vote to migrate questions to SU, but note that only questions less than 60 days old can be migrated, even by moderators.
  • If the question is about the shell as a programming language (expansion, loops, etc.), then it's on-topic on SO and should not be migrated. Most of these questions are also on-topic on SU/U&L/… (as long as it isn't something like “how do I implement a Turing machine in sed”) but that doesn't make them off-topic on SO.
6

In a nutshell we have:

Clear cut scripting questions

These questions are on topic by all criteria listed on the What topics can I ask about here? help page.

Examples:

  • How do I clock execution time of commands?
  • How do I let the user input a username?
  • How do I compare two signed integers in ash?

Clear cut interactive use

These questions are off topic since they are not about programming per see.

One could argue that they are questions about "software tools commonly used by programmers" but it's still borderline since a shell is a very general tool. (We wouldn't want questions about Chromium for example, even though that is a tool commonly used by programmers.)

Examples:

  • How do I increase the bash history?
  • What's the shortcut to cut/paste in bash?
  • How do I edit multiline commands in bash?

Could be either

These could be questions about usage of command line tools often used to automate tasks, how to tweak the output in the shell, etc.

Examples:

  • How do I print the current working directory?
  • How do I redirect stderr to stdout?
  • How do I disable file name expansion (globbing)?

These questions are "unique to software development" the same way as "How to resolve merge conflicts in Git" or "How do I show whitespace characters in sublime?", and they are all on topic for Stack Overflow. (Personally I'd actually argue that those two last examples are more off topic than general shell questions, yet they are very well received by the community.)

Command line tools such as find, awk and xargs can be used used by an interactive shell user, and git and sublime can be used for collaborating on and editing a paper. Doesn't matter much.

The fact that general shell questions are on topic also for UNIX.SE (see their What topics can I ask about here? page) is basically irrelevant. Even if it's "more on topic" on another site, it's still up to OP to decide which site to post on. As long as it is on topic for SO, it's fine to post it on SO.

-4

Based on comments from more experienced users, it looks like the answer relates to how the person is using the shell. "What argument can I pass to cd that will cause it to birth kittens?" is not on topic for SO, i.e. questions about a single command and its uses or arguments that don't otherwise relate to programming.

However, questions relating to scripting are on topic for SO. A shell script is a program and thus... totally alright for SO.

1
  • Though cd is a shell builtin, not an external command. Turns out it's (technically) about the syntax of the language. Commented Nov 18, 2014 at 22:38

You must log in to answer this question.

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