[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
The best language for CLI scripting
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 85
Thread images: 12
File: cli_sm1.jpg (62 KB, 275x275) Image search: [Google]
cli_sm1.jpg
62 KB, 275x275
What language is /g/ using for their everyday CLI apps?
>>
>>51419267
English.
>>
File: bYAoq.png (66 KB, 722x462) Image search: [Google]
bYAoq.png
66 KB, 722x462
>>51419267

Imo PHP is the best. There is no reason for using something else in 2015.
>>
>>51419267
C#
>>
ruby or python anything else is deeldous
>>
>>51419602
>C#

Isn't this inconvenient? You need to build after every update.
>>
>>51419267
bash, python, or perl
>>
>>51419267
bash or python

>>51419349
nigga what
>>
>>51419267
F#
>>
>>51419730
less convenient that using a shit language.
>>
File: 1386120746001.jpg (105 KB, 750x563) Image search: [Google]
1386120746001.jpg
105 KB, 750x563
>>51419349
PHP for shell scripting?
>>
>>51419349

Well either PHP, or csh for sure!
>>
File: php-command-line-usage-520x245.jpg (15 KB, 520x245) Image search: [Google]
php-command-line-usage-520x245.jpg
15 KB, 520x245
>>51420059
>PHP for shell scripting?

Yes PHP-CLI. It has everything that you need for everyday scripting. And it just werk on every platform.
>>
>>51419950
>nigga what

>>51420257

This.
>>
i use perl6

it's really not as bad as you think it is
>>
>>51420257
Pretty sure his point is that PHP is by far the most retarded language in popular usage. It pretty much has no redeeming characteristics. Why you would use it for shell scripting when much better languages are available is beyond me.
>>
python.

argparse is way easier than writing a bash script that parses args. plus python can do ANYTHING with an import.
>>
>>51420347
Because when you're already familiar with php and not bash it can make some things faster

when i was younger i built a cron php script to update a site with my home ip because i didnt feel like setting up no.ip

i even had a bot for a messaging service palringo, written entirely in php that talked over the sockets to palringos servers, even had to use salsa20 for the handshake and shit.

php is amazingly powerful.
>>
>>51420414
computers are powerful in general but that doesn't mean you should use outdated languages. i mean if you're used to it, fine but... there are better languages.
>>
>>51420347
>Why you would use it for shell scripting when much better languages are available is beyond me.

Tons of functions ready to use out of the box?
>>
>>51419267
bash, python or c++. Depending on the libraries/cli tools readily available for the given task.
>>
>>51420455
>outdated languages
>PHP

LOL. What we must then say about C, Java, Perl or JS?
>>
>>51420414
>php is amazingly powerful.

Also This. IN fact I'm even using in I'm one of my data processing projects.

The only minus is that it lacks multithreading and it is somewhat slow, but with php7 the speed in not an issue anymore.

PHP is really neat fucker when it comes to data processing automation.
>>
>>51420595
cant wait till i can start playing with the new php version, spaceships yo

>PHP is really neat fucker when it comes to data processing automation

yea it is, i had to process 250 million records (cities of the word)

i was able to write a php script that handled the upload faster than the dedicated sql software i use (navicat)
>>
>>51419267
Bash, sometimes Java, C if needed (rarely).
>>
Python

Fish if it's less than 5 lines
>>
>>51420466
Like every other good language? Is PHP all you know?

>>51420519
Java is arguably outdated due to C#. Don;t know about Perl. JS and C very much serve and important roles today that are not done better by any other languages.
>>
>>51420257
>>51420290
you can also 'shell script' using x86 ASM. doesnt mean you should.
>>
Reasons to not use PHP outside the web:

- Can't integrate your code with existing projects and scientific libraries that are all written in Python
- Full of built in functions that have no use outside the web
- Disgustingly complex global configuration file that will break everything if it's not set up identical to the developer's
- All of the other reasons that make it a shit language in general
>>
>>51420654
>i was able to write a php script that handled the upload faster than the dedicated sql software i use (navicat)
that's because navicat is shit
use sqlyog

no hate tho, php is great
>>
>>51420414
>not bash
Literally bash is everywhere standard, and you wanna install PHP useless shit first?
bash is out of the box which makes it 1000x better then PHP.
>>
File: 1447721441575.png (77 KB, 763x1037) Image search: [Google]
1447721441575.png
77 KB, 763x1037
>>51420988
>Fish
MUH NUGGA
>>
C
>>
>>51419349
Funny thing I was unironically going to post this.
No joke, for shell scripting PHP really is great.
>>
>>51420414
>i built a cron php script to update a site with my home ip because i didnt feel like setting up no.ip
True, I am doing this for like 2 years now. Awesome shit.
>>
>>51419267
haskell
>>
Lisp because it just makes sense
>>
>>51424104
main = getArgs >>= mapM BS.readFile >>= mapM_ BS.putStrLn

how can anything ever hope to be more beautiful than this
>>
>>51421134
c# is not truly cross-platform
>>
>>51419267
perl
>>
python and go
>>
>>51420011
>C#
>can't into English
How nice of you to join us today, Rajeesh Hijan Patel.
>>
>>51422164

Bash is slow.

sudo apt-get install php5-cli
>>
>>51424135
Does this put the contents of all files in the args to stdout? Neat.
>>
>>51421134
>Is PHP all you know?

No. C# and obviously Python and Perl, since I know PHP.

But for quick and dirty scripts I think that PHP is neat, because it does not bitching for stupid shit and has great documentation.
>>
>>51424174
In what way is that true?
>>
>>51424453
>bitching for stupid shit
you mean it doesn't give out when your code has mistakes in it, that will result in it doing things you weren't intending.
>>
>>51419602
>C#

DESIGNATED
>>
>>51420257
>PHP-CLI
>It has everything you need
$except $a $sane $syntax (pretty sure this also equals true or "0" or what ever)
>>
>>51424483
>you mean it doesn't give out when your code has mistakes in it

No. I mean it does not need "from math import muh dick" library and shit.

You just open text editor put some rows of logic and it works.
>>
>>51424622
>does not need "from math import muh dick"
What are you talking about?

>You just open text editor put some rows of logic and it works.
Just like every programming language then?
>>
>>51424135
>>51424104
My niggas.
>>
>>51424647
>What are you talking about?

It's easy to use it you're not autist.

>Just like every programming language then?

Yeah absolutely.
>>
>>51424730
>It's easy to use it you're not autist.

*easy for use if you're not autist.
>>
>>51424730
>It's easy to use it you're not autist.
Sure, most programming languages are easy to use. Why is PHP easier than others?
>>
One of the worst choices for shell scripting when actually typing the code at the prompt is python because the required whitespace issue but if you are using a separate text editor its mostly irrelevant.

>>51420455
>there are better languages
No, there are different languages. I'm going to assume(stupidly considering this is /g/) you are smart enough that you could do anything in php but its not your preference, which is fine but doesn't make your preferences hold any merit.
>>
>CLI scripting
python/ruby

>real programming
HTML
>>
File: 1447858110258.jpg (202 KB, 460x450) Image search: [Google]
1447858110258.jpg
202 KB, 460x450
>>51419267
Python, perl, or bash
>>
bash and python
>>
>>51425278
>which is fine but doesn't make your preferences hold any merit.
But the fact that PHP is bad in just about every measurable way compared to every single other language with meaningful adaptation does.
>>
File: larry-wall-quick-and-dirty.jpg (56 KB, 450x561) Image search: [Google]
larry-wall-quick-and-dirty.jpg
56 KB, 450x561
Perl
>>
>>51424174
Actually C# itself is perfectly cross platform, especially with Roslyn, you can compile to pretty much anything.
.NET IL used not be crossplatform, but Microsoft is now pushing opensource, and .NET Core is now cross platform meaning you can run many C# apps anywhere.
It's pretty cool news going on right now, I'd say look into it.

>>51419267
Though I still write all my crossplatform CLI in D.
>>
>>51419267
For simple things:
Bash/Perl/Python on *nix
Bash (if I can) / PowerShell on Windows

For complicated things:
C# everywhere I can.
If really I can't, then Java
Lastly, and only with a gun to my head, C++

Though I'll have to use Go at work, so maybe that'll change.
Also I've been looking into Rust as a replacement for C++
>>
>>51424730
>It's easy to use it you're not autist.
autistic people are bad at programming? that's new to me
>>
>>51426005
If it's your own stuff i recommend using F# instead of C# for scripting.
>>
File: file.jpg (741 KB, 1425x1736) Image search: [Google]
file.jpg
741 KB, 1425x1736
luby
>>
>>51426079
Lol I guess I should try to learn it once again.

I've never been able to successfully learn a functional language sadly.
I've tried Haskell and F# several time, but by lack of time, and/or motivation, i'll often end up not doing anything with it and just forgetting all about what I learned.

We use a lot of .Net at work, i'll see if I can go with a simple F# project.
>>
File: pepe....jpg (100 KB, 1278x1181) Image search: [Google]
pepe....jpg
100 KB, 1278x1181
>>51421849
>All of the other reasons that make it a shit language in general
> All of the other reasons

> Lists 0 other reasons
>>
>>51421199
Not on fucking ARM you can't. Or Mips. Or SPARC. Or PowerPC. Or Alpha. Or even Intel 8080. Motherfucking 8080, anon! 8080...

But imagine what it would be like if you could.
>>
Korn shell is best
>>
>>51426192
With F# you can just start using it as if it's C# with python like syntax and type inference. Then start using functional concepts on top of that as you learn them.
>>
>>51425847
>But the fact that PHP is bad in just about every measurable way compared to every single other language with meaningful adaptation does.
Your opinion with no examples means nothing.
>>
>>51426334
>Dynamically typed
>Weakly typed
>Shitty debugging support
>no multi threading
>slow as shit

That's basically enough to make it worse than many many other languages in popular use.

For a complete breakdown of the problems read google the classic article "PHP: a fractal of bad design" (it's been posted so many times on /g/ that the spam filter always thinks it's spam)
>>
>>51426419
>Dynamically typed
Not necessarily worse
>Weakly typed
same
>Shitty debugging support
it's a bit shit oob, but you can install xdebug to make it better
>no multi threading
fair point
>slow as shit
You don't write shell scripts to be blisteringly fast. Besides, PHP7 is a big speed improvement compared to 5.
>>
>>51426511
>Not necessarily worse
It's always worse. There is no benefit to dynamic typing. We have type inference in languages these days.
>same
Even more always worse. This one one of the most widely acknowledged mistakes in JS. It causes a huge percentage of all bugs in JS code. Source: I wrote JS professionally for the past year. I'm pretty good at it.
>it's a bit shit oob, but you can install xdebug to make it better
Or use a language with great debugging support and no drawbacks.
>You don't write shell scripts to be blisteringly fast.
But why not use a slow scripting language when fast ones exist with no disadvantages?
>Besides, PHP7 is a big speed improvement compared to 5.
It's still slower than the alternatives, so who cares?
>>
bash and awk, if I need to parse then yacc
>>
File: 1096.gif (1 MB, 250x230) Image search: [Google]
1096.gif
1 MB, 250x230
>>51419349
>php
>>
>>51426419
>Dynamically typed/Weakly typed
That can be good or bad depending on application.

>Shitty debugging support
That's still your opinion and not a fact. It's fine, not vs level but fine.


>no multi threading
Please research instead of posting made up things. All you had to do is type "php multithreading" into a search engine, but you would rather be ignorant.

>slow as shit
Just as slow as in other languages in its domain. But I've read that the new version is faster than those languages, rather its true or not I don't know. Since you brought speed up, are you using c or assembly.

>That's basically enough to make it worse than many many other languages in popular use.
Until you look at facts and ignore opinions of the misinformed.

>For a complete breakdown of the problems read google the classic article "PHP: a fractal of bad design"
Posting this make me think you are just a shitposter. And by "classic" you mean outdated and irrelevant.

> (it's been posted so many times on /g/ that the spam filter always thinks it's spam)
Because it is outdated blog spam that has no relevance to real world applications.
>>
>>51427098
>That can be good or bad depending on application.
No it's not. Give me an example of it being useful in a situation where static typing wouldn't be the same or better.

>It's fine, not vs level but fine.
That's what I'm saying. Its worse than the alternatives, so why use it?

>"php multithreading"
touche

>Just as slow as in other languages in its domain.
Are you high? Java, C#, JS are all in the same domain (backend languages) and are faster. If you also mean scripting languages than JS, C# and F# all wipe the floor on performance.

>Since you brought speed up, are you using c or assembly.
Neither. Don't know why you are asking. As if only C programmers should care about performance.
>>
>>51419267
bash
python
perl
ruby
>>
File: 1443644049084.gif (94 KB, 240x180) Image search: [Google]
1443644049084.gif
94 KB, 240x180
>>51420363
>writing a bash script that parses args
>not just using getopts which is a POSIX defined function
>hurrr my long options

bitch nigga, if your program needs long options it's already too complex

Make a program that done one thing, and does it well.

bitch get outta this thread
>>
>>51426613
>There is no benefit to dynamic typing. We have type inference in languages these days.

Type inference is not a replacement for dynamic typing. Inference over shitty types helps no one.
>>
>>51427394
>bitch nigga, if your program needs long options it's already too complex
bitch nigga, if your algorithm needs variable names longer than a single character it's already too complex

Do you realize how retarded you sound?
>>
File: 1379636320710.gif (2 MB, 300x264) Image search: [Google]
1379636320710.gif
2 MB, 300x264
>>51427449
>implying option parsing and algorithms are the same thing
>comparing 2 unlike things
>thinking this isn't a logical fallacy

we're done here
>>
>>51427430
>Type inference is not a replacement for dynamic typing.
I know. Dynamic typing is useless in the first place. Type inference just makes statically typed code easier to write and less verbose.
Thread replies: 85
Thread images: 12

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.