What a shitty sidekick character he was. Hated him almost as much as that curly hair guy. Was his name O'Brien?
Connor Powell
>reading is hard
Ryan Johnson
What the actual fuck
I see what its doing, but why the fuck is it interpreting 1+2 as the whole argument instead of interpreting it as 3? For what purpose?
Ayden Morales
bash doesn't do math on the command line...
if you type 1+2, you get "1+2: command not found". it passes these arguments as strings, so you end up doing string concatination in the let statement:
let "sum = 1+2*9+3"
and THEN it does the math eval
Joshua Hall
>basically a mini interpreter that then sets environment variables to its own environments variables wtf is wrong with the shell creators
Nathan Mitchell
Why would you expect that? Bash never evaluates arithmetic expressions unless you tell it to.
Thomas Nguyen
echo $(( (1+2)*(9+3) ))
Henry Russell
>why
Why does it treat those strings at integers when multiplying them, but the string is treated like a string when used as an argument
Nolan Bennett
dumb barclay posters
Dominic Cook
Arithmetic happens inside of $(( )). Don't use retarded bashisms for no reason.
Jason Jackson
>Why does it treat those strings at integers when multiplying them Because there's no such thing as string multiplication. Multiplication is always on ints.
>the string is treated like a string when used as an argument There's no such thing as an integer argument. They are always strings.
Asher Butler
While some of you may be, anyone mind explaining to me why this gives an output of 2 (with an error message)
That's because of the error. A false expression would return 1. Return values greater than 1 indicate an error. And the error gets thrown because a numeric test expects integers.
Dylan Bailey
Are you fucking retarded? Go read a bash tutorial.
Is there any good solution for writing portable shell scripts which doesn’t require writing a shell script? Like a compiler from a sane language to sh?
Oliver Reyes
not that I'm aware of.
as someone who unironically knows shell scripting all too well, my best advice is to write everything "shell oriented" in awk and then do system() or 'your shell string ' sh_escape(arg) ' blah' | getline when you need to do something the awk interpreter doesn't expose to you. awk is shitty as hell, doesn't even have first class array initialisms, regexps, etc but at least it's a normal ass sane language with basic string handling and functions.
Nicholas Mitchell
>sane language to sh The bourne shell is fine, the people who use it are often retards though. see:
Parker Williams
#!/bin/sh
awk
James Perry
never fucking mind im retarded
Hudson Wood
also, honestly. you can just pull an "ansible" and just require python3 to be installed on the targets you script against.
python's standard library is massive and would deprecate the need to use garbage languages like shell and the mess of coreutils altogether.
Eli Brown
Except that your entire OS(POSIX) depends on the bourne shell.
Adrian Martin
no, it doesn't. I can make a linux distro that boots an init that isn't /bin/sh and never have it installed. if the shitty program shells out ever, then I'd just edit the source and fucking remove its use.
Jonathan Barnes
You can't even implement exec() without /bin/sh
Jaxson Williams
what are you on about moron? maybe man 2 execve and fuck right off. it is very possible to have a "poosix" system running without /bin/sh if so desired.
Sebastian Hughes
I asked for the curly hair guy...
Eli Myers
seems like retarded idea anyway, why would you wanna do this?