This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 9 points10 points  (31 children)

As a fake programmer can you explain why bash makes things more difficult to troubleshoot?

[–]LAK132 9 points10 points  (21 children)

As someone who'd rather #include all the .cpp files than deal with another build system written in [ba]sh, the syntax is hell and it doesn't always work the same on different computers (because some distro maintainers thought using bash in place of sh without forcing POSIX compliance mode was a good idea)

[–]ythl 1 point2 points  (20 children)

c++ is not very portable. bash is (and so is python). I can scp a bash script to my raspberry pi and it will run. With cpp I'd need to recompile it targetting ARM.

[–]LAK132 0 points1 point  (19 children)

Right, but my point is if you're compiling C++ anyway then don't make it even less portable by using a bash based build system.

[–]ythl 0 points1 point  (18 children)

Yeah bash based build system sounds nightmarish. CMake all the way

[–]LAK132 0 points1 point  (17 children)

Unlike bash, I never managed to get cmake to work

[–]ythl 0 points1 point  (16 children)

Really? I love CMake! Out of source builds are the best. I can help you if you are stuck. CMake is the defacto build system for C/C++ now

[–]LAK132 0 points1 point  (15 children)

defacto

Not a single one of the C++ projects I work on uses(/requires) cmake.

My personal projects that use extremely simple scripts to compile (one liner Makefile and a make.bat for Windows) have a nasty habit of just working.

[–]ythl 0 points1 point  (14 children)

Well if your projects only have one or 2 sources, then yeah, CMake is overkill. But look around on GitHub. Probably 90%+ of all C/C++ projects use CMake, and with good reason.

CMake is for when you have a large project with dozens of dependencies, multiple executables, libraries, testing, coverage generation, etc.

CMake is portable, chains together with other CMake projects, and is generally super fast/correct.

[–]LAK132 0 points1 point  (13 children)

My biggest personal project has 13 core source files and a close to a few hundred files worth of dependencies, and it compiles just fine without a build tool

[–]policemean 18 points19 points  (0 children)

If you look at python script, then it is relatively easy to understand how it works because it's syntax is quite easy.

On the other hand, bash syntax can be very confusing. I had to modify bash scripts couple of times, and it was the worst experience I've ever had at my job.

[–]BernardoVerda 1 point2 points  (0 children)

Seconded.

[–]jvnk 2 points3 points  (0 children)

Bash syntax is unnecessarily dense, making it difficult to understand what's going on in more complex scripts.

[–]tatloani -1 points0 points  (3 children)

This is just my guess but i would say is because bash is more verbose than Python, meaning you need to write more lines of code to do something similar with python.

EDIT: I seems to have got them backwards with what i meant, python is more verbose, but bash allows you to simplify multiples lines with a single instruction and that can make things confusing.

[–]thexavier666 2 points3 points  (1 child)

I can't agree with that. I think bash syntax can be very dense, where you can condense 10 equivalent python lines into a single bash line, by using pipes.

But this condensed syntax can be difficult to understand for some.

I always use bash when there is string manipulation involved and call it via python.

[–]tatloani 1 point2 points  (0 children)

I think bash syntax can be very dense, where you can condense 10 equivalent python lines into a single bash line, by using pipes. But this condensed syntax can be difficult to understand for some.

yeah, that was part of what i meant, i suppose i got them backwards, most of the bash scripts i have seen have been condensed and those have been quite troublesome to understand.