« first day (1893 days earlier)      last day (3367 days later) » 

01:11
Anyone know any good ports above 1000 that are usually open on default router firewall settings? I have to get around using sudo and my school's firewall for the secondary Minecraft server
1080 works occasionally
1433, 1513, and 1220 don't work
01:24
8000?
My router doesn't listen on any ports by default.
02:15
8080 is common if it's not already used.
02:47
If we're being pedantic, it's ports above 1023 that are available for unprivileged users.
@terdon Of course. That's the nature of chat!
it is funny how "jrg" can convey a different impression than "James"
What's the new impression?
at work, we all have initialisms as handles over the firm's IRC ... some guys are like ABC but some pick like "DAWG"
friendlier, as you thought :)
friendlier, but not as intelligent ;-p
eh.
I don't have a cool name, so I use my first name where I can.
02:57
lol, just kidding ... really I don't think there's a difference as far as intelligence goes ... your pic is probably a bigger factor for impressions, really
True.
@NathanOsman no need to be in awe, there's a bunch of people that spend their days coming up with this stuff... if you think about it like that, it's actually shameful how unimaginative they really are
@Chan-HoSuh yeah
OK, time for my quarterly "Should I use google apps or run my own mail server?" Fiasco.
03:07
it sounds like you usually end up going with google apps?
nah, i ran my own mail server for a bit.
@James your company's website is down
what, hotcards.com or snowypenguinsolutions.com?
the latter
gotcha
Yeah, i'm going to need to spend a few days cleaning up that mess.
03:16
man, wish I'd started a company when I was your age
It uh, wasn't successful.
We lost money every month.
I was too busy doing stupid stuff like going to college and gaining weight from dorm food
I basically burned 2 years of savings on running it for 4 months.
(Granted, 2 years of savings was about $1K)
It was an experience.
And definitely was worth doing.
good to hear
I learned about clients not paying on time, about paying people, and about accounting.
But the biggest lesson was how to present myself to a crowd.
Somebody convinced me to tell my story, and that's when I discovered I like passing along information to the outside world.
03:26
lessons good to discover early
I'm happy for you, man
I do resent it though.
Myself and a few others who got into it early are seen as "whiz kids" in the local community.
when what we really did was get bored and decided to play with fire because nobody wanted to take a chance on us.
and i'm only just now getting rid of that label, 3 years after I started my company.
But anyway... linux is fantastic! ;-)
yep it is
@NathanOsman Are you going to switch to lets encrypt for your mail certificates?
I have a wildcard for *.quickmediasolutions.com.
So it kinda makes sense to use that for now.
Right, but when it expires will you switch?
03:34
Probably.
I'm paying over $100 for the certificate :P
Yeah, isn't cheap.
It's a money grab.
You'll never convince me it's more paperwork to deal with a wilcard cert. than a regular one.
The certificate authorities are gouging us all :P
For extended validation, sure.
But wildcards? nope.
Exactly.
I was originally using StartCom but then it started getting messy with so many subdomains.
And StartCom charges for revocations and basically anything that requires manual intervention.
...so then you have to be extra careful with the private keys, etc.
Yeah
03:39
(Not to imply that I'm normally careless with them.)
(More likely something like this happens :P)
OOOOH. Nice.
I forgot about that!
I do remember seeing that though.
I've never done it since.
But that's what happens when you have too many keys and certs. lying around.
Yeah
 
1 hour later…
04:54
@SmokeDetector sd why
@SmokeDetector !!/coffee
05:08
And gone.
05:18
The titles O_o
Hah!
Yeah
I do admit, I didn't pay attention to @SmokeDetector until just now.
I mean I knew it was a thing people were working on, but didn't realize that it was actively in use
It should start spam flagging things - it'd have a better track record than community at this point lol.
06:05
We've been using it here for months :P
I've probably flagged hundreds of posts thanks to Smoky :P
In fact, on busy days it's a free-for-all to see who can get the messages flagged first before the post gets auto-deleted.
 
1 hour later…
07:21
@SmokeDetector NO.
08:19
@NathanOsman upgoated.
@NathanOsman Oh! George was not really a bot but just you? I vote for George to be allowed back in here! ;-)
Dear spammers - thank you so much for helping me to earn the Marshal badge. You may now stop posting spam.
10
08:35
rofl
If only
sadly the only thing that may stop a spammer for a short time would be some global power outage.
Hello folks !
Need couple of requests please
First of all, I need one answer (old) to be closed as duplicate to be pointed to newer answer
Can we do that ?
@Takkat :D
@Serg link to old and new?
08:39
@Serg there are no dupe answers, only dupe questions.
@Takkat it's hard to brain at 1:40 am, thank you very much
@Takkat Serg never posts any questions: only answers, so he's probably talking about a dupe Q...
:P ;-)
@Serg brain here at 9:40 am at its best
(I'm an old fart and can read between the lines: what people say and what they mean is something different)
08:41
@Fabby which is why you're pretty good at answering questions here, you can read betweenn the lines
I'm very good at answering unclear questions, hence my gold Reversal badge! :D
(reading...)
My POV: the current answer has less upvotes then the old one...
So the reason why i needed that question linked to new one, is because 1) it's dated 2) the answer there is too complex and requires installing weird libraries . . .which are not in ubuntu repos it seems 3) I've made an easy script on the new one
(now comparing solutions)
Second request is very very very optional . . . if you guys could just give me a few upgoats there that'd be great . . . I've been offering bounty on that question, and the high scoring answer only provided partial solution which didn't seem to quite work for me . . . So i wrote a script . . .besides, i cannot give bounty back to myself
I'm not a mod, but I would say: dupe and let me know, and I'l add a dupe vote as well....
I have upvoted already and can add a bounty as well...
08:47
@Serg actually the questions are dupes, and the newer question has better answers... so why not VTC dupe - have my vote.
@Serg A mod agrees with me! ---^ Yeah! :D
;-)
@Fabby no AU mod!!! Then my agreement does not count, really.
@Fabby :) Yay, i can haz close votez . Also, extra bounty isn't necessary, I'll stick with humble upvotes.
Also, im off folks
work starts in about 5 hours, need sleepz
Also, I gonna be gone for 3 days, i have final exam on monday
Bye o/
Voted to close!
And thank you for the upgoats and close votes
09:22
@James Thankfully, there are other "clients", than the official python/docker piece-of-bloat.
user136984
10:08
@Nathan: When I type and I get those dots to show me and others that I am doing so, where are the dots meant to be? Because they were at the bottom before, and now that they are more in the middle for me they look uglier...
11:42
no one here :(
hi rizwind o/
12:08
Who here is familiar with Shell Scripting / Bash?
@MaartenWachters What do you need?
Well I wrote a script for an assignment but I have trouble understanding how to run it properly
it's just basic stuff, make a usergroup , add auser
That is the script (idk how to copy out of VIM).

If I wanted to make a new user via terminal, what exactly do I need to write? I'm stuck on that part
Don't give me screenshots of text! Paste the script here (or, even better, in a question on the main site) so I can copy it and run it.
Ah. VM. Damn. You can share the clipboard or share a directory if you need it.
You have a syntax error on [$username == ""] you need spaces after and before the [ ]: [ $username == "" ].
@MaartenWachters Please post this as a question on Stack Overflow and post a link to it in chat.
@DavidFoerster What? Why SO? It's perfectly welcome here or on U&L.
12:19
Yes, I agree, but I think it's an even better fit for SO.
@DavidFoerster Not at all.
This is classic sysadmin stuff. They're better either here or on Unix & Linux.
@MaartenWachters you want the adduser command.
It's a programming question, isn't it? I see not much system interaction there.
It's not the script thats my problem
it's how I run it via my terminal
Oh, now I see all the adduser stuff & Co.
for example ./opdracht312.sh ????
12:20
Nevermind then
26
Q: Are bash/shell scripting questions on topic?

terdonI have seen a number of users voting to close scripting questions as off topic. Is this the community consensus? Are bash questions not welcome here? How about other shell programming questions?

Shell script questions are usually better on U&L or AU. Even SU. SO is better for more hardcore programming issues. Simple shell scripts don't need to go there. They're on topic but why lose them in the thousands (millions) of SO questions.
@MaartenWachters ?
@MaartenWachters What are create_softlink and mk_shared_folder?
create a softlink between the groupname and the username
@MaartenWachters Why?
It's in the assignment.
12:23
Also, as far as I can tell you're already creating the user. You just have a few syntax errors and many quoting issues that will break your script if you give it bad input or input with whitespace.
@MaartenWachters What's the semantic of softlinks between group names and user names?
What is the actual problem? It should work OK if you fix the syntax errors. What happens when you run it?
I only know softlinks between files
The problem is I don't know how to run it
@MaartenWachters Did you write it?
And we don't don't know, what it's supposed to do.
I'm gonna fail this course
Well, you run it by making it executable (chmod +x /path/to/script) and then executing it /path/to/script -u or /path/to/script -g or /path/to/script -b /path/to/backup/folder
0
Q: Unsure how to use my script

Maarten Wachtersfor my first year CS I need to know Shell Scripting, but I'm really terrible at this. I wrote this script for example #!/bin/bash [ $(whoami) != "root" ] && echo "Run as superuser" && exit 1 while getopts "ugb: " opt; do case $opt in u) read -p "Wat is de naam van de user die je wilt toevoege...

12:27
@MaartenWachters Perfect! Thanks for posting. Writing an answer now.
I feel like I don't understand any of this. Shell scripting / bash. But I'm already 2 Labs behind on the rest of my class
Where the hell is the gvim folder, so I can install the latex suite?
@MaartenWachters How did you write that script then?
@iamatrain In ~/.config` probably.
12:45
@terdon Profs guide
@MaartenWachters I tried to answer, fixing most of the issues. Make sure to read the comments as well. What are reate_softlink and mk_shared_folder? Where are they defined?
I'm not sure. I literally copied it from the slides
@MaartenWachters Is there a particular reason, why you use && instead of the (typically) more readable if ... then ... fi control structure?
you can use multiple lines in a script, not like command line where you need to squeeze it into a one liner
12:50
I'm not sure
This is the 'introduction' to bash scripting
I don't quite understand what I wrote myself
Can you provide a copy of the question or task instructions?
It's password-protected. Please copy or paraphrase the instructions and include them in your question.
@DavidFoerster I prefer that too. I find more concise to generally be more readable.
@MaartenWachters These aren't task instruction. They look like building blocks for your program.
12:52
The task instruction is make that script and add a help function + restore backup
@MaartenWachters You see how he ends each block with ;; and the case with esac? You need to do that. Have you read any basic bash scripting guide? The manual? Anything at all?
I don't know anymore
I'm so confused
@MaartenWachters I seriously doubt, that there are no clear instructions, about what the program is supposed to do. If that is indeed the case, please contact your lecturer/tutor for a clearer definition of the intended function.
We did
Literally 70% dropped out of the course
we only started it 1 month ago
12:54
Oh, great.
our lector , we're his first class ever
I'm literally with my hands in my hair
@MaartenWachters As a university student myself: if the lecturer/tutor is indeed unwilling or incapable of providing clear task instructions, involve a higher authority, e. g. the course coordinator or higher up the faculty chairman.
I can show you the mails I sent
Make sure to exploit all (reasonable) options with the lecturer/tutor themself, first. Make it clear to them, which part(s) of the task are unclear to you.
@MaartenWachters OK, I'm starting to understand. What he has done is give you the structure of the main program and then the functions you need to call. The things that look like foo(){ ... } are function. You need to add them at the beginning of your script and then you call them. For example:
12:57
I'm a student with dissabilities, I have special needs (i'm required to mail all questions) to lectors
#!/bin/bash
function foo(){ echo "Hello"; }
foo
The above will print "Hello" because foo is a function, so when you run it, it will run the code given in the function.
That I understand and done in another script
I'm up to that point
Let me get that 1 second
@MaartenWachters Well, then why are you adding the content of the functions in the case statement?
Let;s back up a second. Do you understand how case statements work?
I reckon so, I use em in C#, JS , etc
#!/bin/sh
create_group(){
        sudo addgroup  maarten
        sudo addgroup  wouter
}
create_group
create_user(){
        sudo adduser jos maarten
        sudo adduser maarten wouter
}
create_user
create_softlink(){
        ln -s /usr/share /home/maarten
}
create_softlink
create_lector(){
        sudo addgroup lector
        sudo adduser jos lector
        ln -s /usr/share /home/lector/jos
}

create_lector

create_group2(){


}

create_group2
Wow sorry
@MaartenWachters OK, good. So you also understand what functions are.
@MaartenWachters ?
13:01
that you mean with cases right?
And yes I know what functions are
@MaartenWachters No, those are functions, not case statements.
I'm trying to understand what part of the assignment confuses you. What you understand and what you don't.
I'm unsure wether a case statement is any diffrent in bash then in FE C#
@MaartenWachters AFAIK it's the same. The syntax might be different (don't know C#) but the concept should be the same. It executes a specific code block based on the value of a variable.
The syntax is :
case $var in
   foo)
      command1
   ;;
   bar)
       command2
   ;;
esac
I don't understand the variables then I guess
But Yes, I understand the gis of the case syntax then
OK.
What is it that confuses you then?
13:13
What I need to do
:) I don't know, it depends on what you've been asked to do.
if we look at the general structure of this slide prntscr.com/9alirw
I think the teacher wants to o combine the functions into a working program.
it says "while getopts "ugb : " opt, do
what does the "ugbd :" stand for / do?
Ah, yes, those are the valid options: u, g and b where b can take a value.
13:15
So I'd need to do
Open a terminal and run help getopts for more.
./scriptname.sh -a to call whats in a?
@MaartenWachters Yes. Well, not a since that's not a valid option but ./scriptname.sh -u for example.
I read the getopts page (wiki.bash-hackers.org/howto/getopts_tutorial) a thousand times so far
@terdon Okay now I understand that. So if I were to have cases u, g, b, v , x and I want to run u, g , v. I'd do ./scriptname.sh -u -g - v for example?
Yes
13:17
Okay now I understand a lot more
but I'm very confused on the function part
For example prntscr.com/9alk7x. We have the adduser part (wich for now we'll put in case u)
@MaartenWachters Wait, before we get to that. I had a mistake in my answer. When you have b:, that means b takes an argument.
uhh now you've lost me again
In this case, the name of the backup folder. When getop options take arguments, they are stored as $OPTARG. So, to create a backup folder named foo wioth getopts, you would need something like this:
#!/bin/bash
while getopts "b: " opt; do
    case $opt in
	b)
	    ## $OPTARG is whatever was given as an argument for -b
	    mkdir "$OPTARG"
	    ;;
    esac
done
You then run it like this:
./script.sh -b foo
And it will create the directory foo.
what is the $OPTARG?
so wait
> OPTARG This variable is set to any argument for an option found by getopts. It also contains the option flag of an unknown option.
It's explained in the bash hackers wiki page you gave.
13:21
So -b foo > foo is stored in $OPTARG
Yes
then we make directory optarg
Yup. Note that the value of $OPTARG depends on which of the options getopt is currently processing. So with script.sh -a foo -b bar, it will be foo when $opt is a and bar when $opt is b.
Okay
Starting to understand it now, brain is just a lil on the slow side
The gentent line, what does it do? I'm not sure what getent is or does
Run man getent
In this case, it prints information about a group. For example, on my system:
$ getent group terdon
terdon:x:1001:
13:27
it's basically a reference to where something is saved?
or am I misinterpreting the man page
That tells me that the group terdon exists, has no password (the x in the second field), and has the GID of 1001.
@MaartenWachters In this case, it's just a simple way to check whether a group exists or not. Try it on your system with a group that exists and one that doesn't:
$ getent group root ## exists
root:x:0:root
$ getent group foobar ## doesn't
$
> getent group maarten
> maarten:x:1000:jos
So, the script is using it to test whether the group it is supposed to add the user to exists.
Read what it prints. If the output of getent group groupname is empty (==""), it tells you that the group doesn't exist and exits. I don't speak Dutch but it seems like the error message tells you as much.
Yep
The && in bash seems diffrent then in other languages
here it's not really "AND" but more of an "IF DO"
Not really.
C-like languages all have this so-called “short-circuit logic” for logical operands && and ||.
13:33
@MaartenWachters No, it's an AND. In command1 && command2 it means "run command2 if and only if command1 exited successfully".
It also acts as a "normal" AND in the context of a test:
$ a="10"
$ if [[ "$a" -lt 100 && "$a" -gt 5 ]]; then echo YES; fi
YES
So, what's the next problem?
Just taking everything you explained now and writing my script again
OK. Do you understand how to use the functions now?
#!/bin/bash

function printU(){
    echo "You chose -u"
}


while getopts "u" opt; do
    case $opt in
	u)
	    printU
	    ;;
    esac
done
yes
you declare what function printu does
then inside your getopt you call function printu , so it runs what is said inside that
13:47
Exactly. In your original script, you had moved the function's commands into the case statement.
Wich I shouldn't
?
Do i declare my functions between my whoami and getopts or infront of whoami
if that makes any sense
@MaartenWachters You need to declare them before you call them. Just add them at the beginning of the script.
I understand that
But does it matter if I do it before i check if its ran as root or not
In this case, it doesn't.
No, not really. It's just neater if you have all the functions defined before the start of the program.
13:53
The difference is insignificant in almost all correct scripts.
I swear the two of you have learnt me more so far then my prof.
Yeah, the question is, if we taught you the right stuff to pass your class.^^
My fellow students and I complain over him vs eachother (he has the same name as me by chance) but I don't think any of us have actually filed a complained
I wouldn't start with a formal complaint. Go up to him after class or during a tutorial session and address your (collective) issues.
Yeah , I need to now figure out how to restore a backup. But haven't tried that much. I'd rather try myself first
Yeah perhaps
13:55
Yes, what David said. Just tell him you're having trouble understanding.
my last script I written
I got 4 / 20
If you want to address them efficiently, collect them and write them out clearly, beforehand.
I literally cried in class, as I take uni very serious
Teachers often forget what it was like not to know all the stuff they do. Things seem very simple when you've been doing it for years.
@MaartenWachters That might be taking it a little too seriously.
You gotta know I need good grades to sustain myself right now
I live alone and get government support (disability + tuition) so bad grades = i'm forced to live back home
13:57
@MaartenWachters Failing one class or the other is relatively normal, espc. in natural sciences and engineering and even more so during the first semester(s). Most students need to adjust to the different mode of teaching and leearning in university.
if I don't pass one class, I can't pass to year 2
My school is pretty prestigious in the CS departement, and very strict too
I had many co-eds, who had to repeat introductory courses, but still graduated on schedule with good or very good grades.

« first day (1893 days earlier)      last day (3367 days later) »