[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

>writing a short bash script woow anon are u a hacker?

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 50
Thread images: 5

File: script.png (46KB, 500x588px) Image search: [Google]
script.png
46KB, 500x588px
>writing a short bash script

woow anon are u a hacker?
>>
Your program is silly.
>>
>>60259609
>Console pops up
>"A hacker! A hacker! SEcurity!"
>U get arrested
>>
File: 1493807553759.jpg (8KB, 250x238px) Image search: [Google]
1493807553759.jpg
8KB, 250x238px
>Happy Christmas
>>
>>60259609
Fucking disgusting, use Python or Ruby instead.


Protip, though, if you're going to use bash then use it with https://www.shellcheck.net
>>
>>60260027
nigga why don't you shut up?
>>
>>60260027
OcaML for anything that runs as root or touches files. Preferably also verified with whatever proof assistant you prefer. That's the ONLY way to write scripts these days.
>>
>>60259609
>if month <= 3
>else if month > 3
>>
>tfw some guy tk'd me in Red Orchestra 2 but didn't apologize so I wrote a shitty python script to alert me whenever he was online and join his game to tk him then disappear
>>
>>60260027
>Fucking disgusting, use Python or Ruby instead.
Not Perl. Why do you hate Unix anon?
>written in Haskell, if you're into that sort of thing.
Software powered by turbo autism is guaranteed that a really nasty bug exists.
>>
>>60259933
>try to learn my way around centOS
>have it on my laptop so i get used to it
>go to cafe
>want to check my mail (no smartphone at the time)
>turn on laptop and ask guy working there for the wifi pass
>x doesn't start automatically
>tfw he looks at the screen
>"no way ima let you hack our computers"
>"i suggest you leave before i call the cops"
I learned my lesson then and there.
>>
>>60262445
You could have just started x. Also why are running centos without a GUI on your laptop?
>>
>>60262199
Right continue to write shitty bash scripts full of bugs and gotchas instead of using the best bash linter available because it was written in Haskell. I guess you shouldn't use Chef either.

Why use disgusting perl when beautiful and simple Ruby exists?
>>
>>60260027
>installing additional software when you could just use onboard utilities
yeah no thanks
>>
>>60264258
>continue to write shitty bash scripts full of bugs and gotchas
Only literal retards can't write well-defined and function bash scripts.
if [ x$VARIABLE = x ]; then

Best sign of said retards.
>>
>>60260710
Maybe in 2050. The world is lagging far, far behind.
>>
>>60264366
I see that in a lot of OpenBSD scripts but with double quotes. And I don't know why.
>>
>>60264366
>i won't use a linter because of my pride
>>
>>60259609
>Writing more than one line of bash
The only system you're gonna fuck up is your own
>>
>>60259609


if (true): print("Lick my nuts")

>>
>>60259609
set -euo pipefail
IFS=$'\n\t'


if you don't put this at the top of every script, you shouldn't be allowed within 100 feet of a text editor.
>>
>>60262445
/r/thathappened
>>
>>60264801
I've tried to use linters with C, and it's useless. They just catch harmless and sometimes even counterproductive bullshit.
>>
>>60261950
That's pretty hilarious.
>>
>>60265273
set: No such file or directory
rc: empty argument list
>>
>>60265386
They're not all bad. That bash one is good and really helped up my bash game. It will warn you about stuff you see all over stack overflow and probably thought was the "best" way to do things.

I have my editor setup with linters for every language I use, Python, Ruby, bash, and some DSLs like Puppet and Chef.
>>
>>60259609
>line 33 and 37 are repeated
really trigger my autism
>>
>>60259914
it's qt desu
>>
>>60261950
how do you check the player list on a server?
is there an API for the game?
>>
>>60259935
Fuck off kike
>>
>>60265673
>That bash one is good and really helped up my bash game.
I've literally never had a problem writing bash scripts, however.
>>
>>60264407
Because if the variable is empty the test breaks. Try it.
>>
>>60259609
use case instead of if/else
don't use deprecated ` backticks, use $() braces instead
>>
>>60266726
Well either try it or don't, but you just might learn something.
>>
How do I write standards compliant shell scripts and not bash?
More importantly, how do I do arrays in a posix compliant shell script?
>>
>>60267781
I promise I'll try crutches as soon as I've broken a leg.
>>
>>60266234
Nah, it wasn't anything intelligent just imported a web library and was dependent on their Steam profile not being private iirc.

I'll screenshot it in a while when as I need to access the drive it is on lel
>>
>>60264300
python pretty much comes with every distro by default
>>
File: possible_weaponized_autism.jpg (173KB, 681x1001px) Image search: [Google]
possible_weaponized_autism.jpg
173KB, 681x1001px
>>60267917
>>60266234
>>60265550
>>
>>60259935
good bait, retard
>>
>>60268212
where does this script print the output?
in cmd?
desktop notification?
i'm not familiar with python
>>
>>60268309
Straight to the nearest line printer
>>
File: 1431393087662.jpg (223KB, 1025x1000px) Image search: [Google]
1431393087662.jpg
223KB, 1025x1000px
>>60268212
>tfw a year of C++ and all i have is a password generator and a tic-tac-toe game
>>
>>60260027
rate my Ruby-inspired bash script
ls
ls..
cd code
cd..
>>
>>60260027
Use Tcl, the one true shell scripting language.
>>
>>60269071
A plus you're hired femanon
>>
>>60259609
Could I ask: why did you put in those else statements?
Does the date get fudged up from time to time, hence warranting such else statements?
I mean, I understand it's a good habit and all. I just wonder.

>>60260027
>Use Python
So would this be better?
from time import localtime

text_month = ["It's a long time until Christmas",
"It's a while until Christmas",
"Soon we'll be thinking about Christmas",
"Not long now until Christmas"]

text_day = ["Just a few days until Christmas",
"Christmas is less than a week away",
"Happy Christmas",
"So that was Christmas"]

def func():
day = localtime().tm_mday
if(day<18):
return 0
elif(day<24):
return 1
elif(day==25):
return 2
else:
return 3

month = localtime().tm_mon

if(month == 12):
print(text_day[func()])
else:
print(text_month[(int)(month/3)])

I was once chastised for using switch statements. Was told arrays would be better.
>>
>>60270143
Switch would be better in this case. Definitely some code smells with this approach.
>>
>writing a hello world program in python
"Holy fuck anon, put that away before the fbi sees it! I don't know him!"
>>
File: giphy (4).gif (980KB, 500x221px) Image search: [Google]
giphy (4).gif
980KB, 500x221px
Thread posts: 50
Thread images: 5


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.