Skip to main content
15 events
when toggle format what by license comment
Mar 31, 2021 at 9:57 history reopened terdon bash
Apr 16, 2020 at 3:53 history closed GAD3R
schrodingerscatcuriosity
Paulo Tomé
AdminBee
muru
Duplicate of Shell Script Requiring 1 Argument with If/Else/Elif Statements [closed]
Apr 10, 2020 at 20:27 answer added Kusalananda timeline score: 1
Apr 9, 2020 at 21:16 history edited Derek CC BY-SA 4.0
edited body
Apr 9, 2020 at 21:16 comment added schrodingerscatcuriosity @Derek Go step by step. You don't need to code the whole thing at once. Write down every problem you need to solve. Then try to solve problem by problem. Use the terminal to test code, you don't need to write it everytime in a file and run it. Use google with key words: "bash command find user id". You will have tons of results (the bests from stackexchange). Test the commands in terminal, see what the output is, try sed, grep, cut... etc to parse the that output. Think on what control structure could you use: if, for, while, etc. Have in mind that coding needs practice.
Apr 9, 2020 at 21:11 comment added Derek Obviously code does not work like this unfortunately but this is as far as I could get. I don't know the logic to implement for this to work. pastebin.com/G3wKPf5x
Apr 9, 2020 at 20:57 comment added Derek I don't know how to differentiate and make the correct output appear. Am I suppose to use one big if statement? How do I tell it to appear is not a valid user if its not a valid user, if the user is logged on, if it's not logged on.
Apr 9, 2020 at 20:48 comment added Derek I honestly don't know where to start or the setup that I need. I tried my best to explain what I need done into words but I don't know how to translate that into code. I am just learning this. I'll try right now. I have the if statement for the arguments which I posted above. If user doesn't give an argument when executing the script, then it will ask the user what username. Then the else will go through the checks of whether or not the user exists, whether they are logged in, etc. (like the code examples I wrote above) I guess I am stuck on the checks part and implementing that?
Apr 9, 2020 at 20:27 comment added schrodingerscatcuriosity @Derek Do the best you can to show us what code you can manage to write, it doesn't matter how bad it could be, without mention of the homework guide you where assigned. I tell you this because this question is also gonna be closed, unless you edit it showing specific problems, from actual code.
Apr 9, 2020 at 20:11 comment added Derek Does not. My last question got locked because I kept editing it to make it clearer.
Apr 9, 2020 at 20:09 comment added Kusalananda In what way is this different from your last question?
Apr 9, 2020 at 19:30 review Close votes
Apr 16, 2020 at 3:55
Apr 9, 2020 at 19:11 history edited GAD3R CC BY-SA 4.0
edited body
Apr 9, 2020 at 18:52 history edited Derek CC BY-SA 4.0
added 10 characters in body
Apr 9, 2020 at 18:45 history asked Derek CC BY-SA 4.0