Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I've been getting into bash lately cos of some devops stuff that's been assigned to me. I gotta say... It's awful and weird and brilliant at the same time. I love it but I feel like I shouldn't.
-
I don’t see anything genius about “> file” instead of “touch file”. We software developers should strive to make every piece of code easy to understand, in reasonable manner.
-
Bibbit7404yI've had a few experiences with bash, but nothing too spectacular.
Although it's a handy shortcut, I must say that I agree with the others: you won't save a lot of time imo since they're so short and anything longer than ~3 letters can probably be autocompleted if you really want to. You only add complexity and make it less readable for a minimal gain in script size.
Are there any significant pros for choosing the < & > over their corresponding function names?
Note: I say this from a dev pov, since I honestly cannot say if a difference of a few characters per line are worth the loss of readability... -
Bash is a good language to write obfuscated code in.
But if you really into obfuscation, go for Brainfuck or Intercal instead.
Even less readable may be code written in Whitespace using only whitespace characters... -
hjk10157314yAs @aviophile said just use touch for that unless you need some specific content like a pid or timestamp (for backup verification for example, always check contents)
-
@iiii
That looks like a nice language for the next tamper-proofing tool for protecting DRM in commercial software.
Must be absurdly hard to crack something that has been transcoded to Malbolge... -
Condor324964y@aviophile now do that for a fleet of 10.000 servers and you start to realize that CPU time is actually more valuable than development time. Easy to read? Data comes in, data comes out. Can't be easier to me. It's merely something I wouldn't have thought about otherwise.
-
Condor324964y@NEMESISprj script size or savings in typing aren't what I'm concerned with, nor is it what the original author was (this came from a BGP tutorial iirc). The issue is that touch is an external command that needs to be loaded from disk - another program has to be called. Bash internals are generally better in that regard.
-
Bibbit7404y@Condor ohh I didn't know that touch was external and the > was internal. Makes a lot more sense now for me after your explanation, thanks!
Related Rants
I'm not a programmer by trade, so the only language I know well is bash. But as sysadmins we do use bash often.
Looking at other sysadmins' scripts though, there are interesting things in it every so often. Like for example `touch file` which creates a file. I've seen some sysadmins just do this instead `> file`. Genius! Or perhaps a `cat file >> elsewhere`. You can do that with `< file >> elsewhere`. It's something that if I hadn't seen it elsewhere, I wouldn't have thought about. But yeah, it saves a program call and it works!
rant
bash
wk231